Accessing the HTTP Accept-Language header

Our engine is strongly localized. All error messages and return values pass through translation, if needed. As such, when we call the engine from a workflow activity, we need to be able to insert something into the context to tell the engine which language to use. In gRPC we do this using a unary interceptor that extracts the language from the HTTP Accept-Language header element and amends the context, on each call. How can we do this in Temporal? It looks at first pass like WorkerOptions.BackgroundContext is the only available means, and that this context is common to all calls received by the worker.

Write a custom ContextPropagator.

That’s what I was looking for, thank you.

1 Like