Interface DeadLetterJpaConverter<M extends EventMessage>

Type Parameters:
M - The type of the event message this converter will convert.
All Known Implementing Classes:
EventMessageDeadLetterJpaConverter

public interface DeadLetterJpaConverter<M extends EventMessage>
Converter that can convert an EventMessage to a DeadLetterEventEntry and vice versa.

Tracking tokens and aggregate data (only if legacy Aggregate approach is used: aggregate identifier, type, sequence number) are stored and restored as Context resources. This converter handles storing these resources as separate columns in the database and restoring them when converting back.

Since:
4.6.0
Author:
Mitchell Herrijgers
  • Method Details

    • convert

      DeadLetterEventEntry convert(M message, @Nullable Context context, EventConverter eventConverter, Converter genericConverter)
      Converts an EventMessage implementation and its associated Context to a DeadLetterEventEntry.

      The context is used to extract tracking token and domain info (aggregate identifier, type, sequence number) if present. When the context is null, no resources are extracted and corresponding fields in the resulting DeadLetterEventEntry will be null.

      In most cases a non-null Context is expected, as the SequencedDeadLetterQueue is typically invoked through Axon's event handling logic, which always provides a context. A null context is only expected when the SequencedDeadLetterQueue is invoked directly by user code outside of the framework's processing pipeline.

      Parameters:
      message - The message to convert.
      context - The context containing resources such as tracking token and domain info.
      eventConverter - The EventConverter for conversion of payload and metadata.
      genericConverter - The Converter for conversion of the tracking token, if present.
      Returns:
      The created DeadLetterEventEntry.
    • convert

      MessageStream.Entry<M> convert(DeadLetterEventEntry entry, EventConverter eventConverter, Converter genericConverter)
      Converts a DeadLetterEventEntry to a MessageStream.Entry containing the EventMessage implementation and a Context with restored resources.

      The returned entry's context contains the restored tracking token and domain info (aggregate identifier, type, sequence number) if they were stored when the dead letter was enqueued.

      Parameters:
      entry - The database entry to convert.
      eventConverter - The EventConverter for deserialization of payload and metadata.
      genericConverter - The Converter for deserialization of the tracking token, if present.
      Returns:
      A MessageStream.Entry containing the message and context with restored resources.