diff --git a/internal/headers.go b/internal/headers.go index 02b535c5e..ec98eb33a 100644 --- a/internal/headers.go +++ b/internal/headers.go @@ -62,9 +62,13 @@ type ( ExtractToWorkflow(Context, HeaderReader) (Context, error) } - // ContextAware is an optional interface that can be implemented alongside DataConverter. - // This interface allows Temporal to pass Workflow/Activity contexts to the DataConverter - // so that it may tailor it's behaviour. + // ContextAware is an optional interface that can be implemented alongside + // DataConverter. This interface allows Temporal to pass Workflow/Activity + // contexts to the DataConverter so that it may tailor it's behaviour. + // + // Note that data converters may be called in non-context-aware situations to + // convert payloads that may not be customized per context. Data converter + // implementers should not expect or require contextual data be present. ContextAware interface { WithWorkflowContext(ctx Context) converter.DataConverter WithContext(ctx context.Context) converter.DataConverter diff --git a/workflow/context.go b/workflow/context.go index d7b20dacf..9abe412c9 100644 --- a/workflow/context.go +++ b/workflow/context.go @@ -36,9 +36,13 @@ import ( // Context's methods may be called by multiple goroutines simultaneously. type Context = internal.Context -// ContextAware is an optional interface that can be implemented alongside DataConverter. -// This interface allows Temporal to pass Workflow/Activity contexts to the DataConverter -// so that it may tailor it's behaviour. +// ContextAware is an optional interface that can be implemented alongside +// DataConverter. This interface allows Temporal to pass Workflow/Activity +// contexts to the DataConverter so that it may tailor it's behaviour. +// +// Note that data converters may be called in non-context-aware situations to +// convert payloads that may not be customized per context. Data converter +// implementers should not expect or require contextual data be present. type ContextAware = internal.ContextAware // ErrCanceled is the error returned by Context.Err when the context is canceled.