Interface DeadLetterJpaConverter<M extends EventMessage>
- Type Parameters:
M- The type of the event message this converter will convert.
- All Known Implementing Classes:
EventMessageDeadLetterJpaConverter
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 Summary
Modifier and TypeMethodDescriptionconvert(M message, @Nullable Context context, EventConverter eventConverter, Converter genericConverter) convert(DeadLetterEventEntry entry, EventConverter eventConverter, Converter genericConverter) Converts aDeadLetterEventEntryto aMessageStream.Entrycontaining theEventMessageimplementation and aContextwith restored resources.
-
Method Details
-
convert
DeadLetterEventEntry convert(M message, @Nullable Context context, EventConverter eventConverter, Converter genericConverter) Converts anEventMessageimplementation and its associatedContextto aDeadLetterEventEntry.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 resultingDeadLetterEventEntrywill benull.In most cases a non-
nullContextis expected, as theSequencedDeadLetterQueueis typically invoked through Axon's event handling logic, which always provides a context. Anullcontext is only expected when theSequencedDeadLetterQueueis 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- TheEventConverterfor conversion of payload and metadata.genericConverter- TheConverterfor conversion of the tracking token, if present.- Returns:
- The created
DeadLetterEventEntry.
-
convert
MessageStream.Entry<M> convert(DeadLetterEventEntry entry, EventConverter eventConverter, Converter genericConverter) Converts aDeadLetterEventEntryto aMessageStream.Entrycontaining theEventMessageimplementation and aContextwith 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- TheEventConverterfor deserialization of payload and metadata.genericConverter- TheConverterfor deserialization of the tracking token, if present.- Returns:
- A
MessageStream.Entrycontaining the message and context with restored resources.
-