Interface SerializationContext

All Known Subinterfaces:
HasWorkflowSerializationContext
All Known Implementing Classes:
ActivitySerializationContext, WorkflowSerializationContext

@Experimental public interface SerializationContext
Temporal SDK may provide a subclass of SerializationContext during data serialization to identify the context of this serialization. This context is composed in a way to guarantee that a user object, and it's corresponded Payload will always be handled by the serialization and data conversion process with the same exact context.

SerializationContext scope is defined by a Serialization Target. Serialization Target is the lowest actor in the call tree that the serializing / deserializing object or Payload belongs to. For example:

  • Workflow Input and Output parameters will always get WorkflowSerializationContext identifying the workflow both on the WorkflowClient and Workflow Worker sides.
  • Side Effect output parameters are contextualized with WorkflowSerializationContext of the workflow this side effect belongs to.
  • Activity Input and Output parameters will always get ActivitySerializationContext identifying the activity and it's workflow on both Workflow Method and Activity Worker sides.
  • Child Workflow Input and Output parameters will always get WorkflowSerializationContext identifying the child workflow on both Parent Workflow and the Child Workflow sides.

Temporal SDK provides SerializationContext to Data Serialization process through calling withContext on DataConverter.withContext(SerializationContext), PayloadCodec.withContext(SerializationContext), and PayloadConverter.withContext(SerializationContext) and using the modified instance when applicable.

Nexus operations inside a workflow do NOT have a WorkflowSerializationContext because it is not available in the operation handler.

Note: Serialization Context is experimental feature, the class and field structure of SerializationContext objects may change in the future. There may be also situation where the context is expected, but is not currently provided.