Class NexusSerializationContext

java.lang.Object
io.temporal.payload.context.NexusSerializationContext
All Implemented Interfaces:
SerializationContext

@Experimental public final class NexusSerializationContext extends Object implements SerializationContext
SerializationContext for Nexus operation payloads, identifying the Nexus endpoint, service, and resolved operation the payload belongs to.

This context is used for payloads exchanged between a Nexus caller and handler: operation inputs, results, and failures. When a handler starts a workflow or standalone activity, or sends a workflow update, to back an operation, whatever it returns to the caller, such as its result or failure, is serialized with this context too, so the caller can decode it. Everything else keeps the workflow's or activity's own context. This requires a server that propagates the context.

To complete such an activity asynchronously, store the context from ActivityInfo.getNexusSerializationContext() with the task token and pass it to ActivityCompletionClient.withContext(NexusSerializationContext).

Some payloads, such as failures and payloads from older servers, may be serialized without this context. Context-dependent encodings, including in a FailureConverter, should be self-describing, and decoders should accept payloads encoded without a context.

  • Constructor Details

    • NexusSerializationContext

      public NexusSerializationContext(@Nonnull String endpoint, @Nonnull String service, @Nonnull String operation)
      Parameters:
      endpoint - the Nexus endpoint name; must not be null
      service - the Nexus service name; must not be null
      operation - the resolved Nexus operation name; must not be null
  • Method Details

    • getEndpoint

      @Nonnull public String getEndpoint()
      Returns:
      the Nexus endpoint name
    • getService

      @Nonnull public String getService()
      Returns:
      the Nexus service name
    • getOperation

      @Nonnull public String getOperation()
      Returns:
      the resolved Nexus operation name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object