Record Class TransformationContext

java.lang.Object
java.lang.Record
io.axoniq.framework.messaging.transformation.TransformationContext
Record Components:
entryContext - the Context attached to the source message, carrying its position for use in diagnostics, never null
processingContext - the active unit of work for this transformation, or null when none is active
converter - the converter used to convert the input payload to the transformation's input type, never null
messageTypeResolver - the resolver used to validate the transformed output's message type, never null

@Internal public record TransformationContext(Context entryContext, @Nullable ProcessingContext processingContext, MessageConverter converter, MessageTypeResolver messageTypeResolver) extends Record
Immutable per-invocation context handed to a MessageTransformation when it transforms a single message.

It groups two contexts with distinct roles. entryContext is the Context attached to the source message. It is always present and, where the source provides one, carries the message's position for use in diagnostics. processingContext is the active unit of work for the transformation. It is present when the transformation runs inside a unit of work, such as an entity load, and null when none is active, such as while an event stream is being opened.

converter and messageTypeResolver are held as explicit fields rather than read from processingContext, because that context is not always present.

Since:
5.2.0
Author:
Laura Devriendt
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entryContext

      public Context entryContext()
      Returns the value of the entryContext record component.
      Returns:
      the value of the entryContext record component
    • processingContext

      public @Nullable ProcessingContext processingContext()
      Returns the value of the processingContext record component.
      Returns:
      the value of the processingContext record component
    • converter

      public MessageConverter converter()
      Returns the value of the converter record component.
      Returns:
      the value of the converter record component
    • messageTypeResolver

      public MessageTypeResolver messageTypeResolver()
      Returns the value of the messageTypeResolver record component.
      Returns:
      the value of the messageTypeResolver record component