# Passing per-activity field into contextAware dataConverter's codec

**URL:** <https://community.temporal.io/t/passing-per-activity-field-into-contextaware-dataconverters-codec/18291>\
**Category:** Community Support\
**Tags:** go-sdk, activity\
**Created:** [September 3, 2025, 10:07pm UTC](https://community.temporal.io/t/passing-per-activity-field-into-contextaware-dataconverters-codec/18291 "2025-09-03T22:07:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![white\_screen](https://avatars.discourse-cdn.com/v4/letter/w/f14d63/32.png) [@white\_screen](https://community.temporal.io/u/white_screen)\
**Post date:** [September 3, 2025, 10:07pm UTC](https://community.temporal.io/t/passing-per-activity-field-into-contextaware-dataconverters-codec/18291/1 "2025-09-03T22:07:26Z")

</div>

Hi all,

I’m new to Temporal and trying to figure out best practices around per-activity context with a shared client. My setup:

- The Temporal client is initialized once at server start.
- The `ContextAwareDataConverter` is also initialized once with the client.
- I need per-activity encryption keys (KeyID) to be available to my codec.

Currently, I create a new codec on every `WithContext` call, passing in the context:

```auto
func (d *ContextAwareDataConverter) WithContext(ctx context.Context) converter.DataConverter {
    codec := &codec{
        keyManager: d.keyManager,
        ctx: ctx,
    }
    return converter.NewCodecDataConverter(d.DataConverter, codec)
}

```

Now I’m considering adding something like:

```auto
mySDKWrapper.ExecuteActivity(ctx, keyID, activity, args...) {
    workflow.WithValue(ctx, "keyID", keyID)
    temporal.ExecuteActivity(ctx, activity, args...)
}

```

…and then having `codec.Encode` / `codec.Decode` fetch `keyID` from the context.

I’m fairly set on using `ContextAwareDataConverter`. My question is: **what’s the best way to pass per-activity keys into the codec in this setup?** Should I use `workflow.WithValue`, a context propagator, or another pattern entirely?

Thanks in advance for guidance!
