Class EventMessageDeadLetterJpaConverter
- All Implemented Interfaces:
DeadLetterJpaConverter<EventMessage>
EventMessage implementations for storage in a
SequencedDeadLetterQueue.
Tracking tokens and aggregate data (only if legacy Aggregate approach is used: aggregate identifier, type, sequence
number) are stored as Context resources. This converter extracts these resources from the context during
serialization and restores them to the context when deserializing.
- Since:
- 4.6.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(DeadLetterEventEntry entry, EventConverter eventConverter, Converter genericConverter) Converts aDeadLetterEventEntryto aMessageStream.Entrycontaining theEventMessageimplementation and aContextwith restored resources.convert(EventMessage message, @Nullable Context context, EventConverter eventConverter, Converter genericConverter)
-
Constructor Details
-
EventMessageDeadLetterJpaConverter
public EventMessageDeadLetterJpaConverter()
-
-
Method Details
-
convert
public DeadLetterEventEntry convert(EventMessage message, @Nullable Context context, EventConverter eventConverter, Converter genericConverter) Description copied from interface:DeadLetterJpaConverterConverts 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.- Specified by:
convertin interfaceDeadLetterJpaConverter<EventMessage>- 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
public MessageStream.Entry<EventMessage> convert(DeadLetterEventEntry entry, EventConverter eventConverter, Converter genericConverter) Description copied from interface:DeadLetterJpaConverterConverts 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.
- Specified by:
convertin interfaceDeadLetterJpaConverter<EventMessage>- 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.
-