Class GenericResetContext
java.lang.Object
org.axonframework.messaging.core.MessageDecorator
org.axonframework.messaging.eventhandling.replay.GenericResetContext
- All Implemented Interfaces:
Message,ResetContext
Generic implementation of the
ResetContext interface.- Since:
- 4.4.0
- Author:
- Steven van Beelen
-
Field Summary
Fields inherited from interface org.axonframework.messaging.core.Message
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionGenericResetContext(Message delegate) Constructs aGenericResetContextfor the givendelegate, intended to reconstruct anotherResetContext.GenericResetContext(MessageType type, Object payload) Constructs aGenericResetContextfor the giventypeandpayload.GenericResetContext(MessageType type, Object payload, Map<String, String> metadata) Constructs aGenericResetContextfor the giventype,payload, andmetadata. -
Method Summary
Modifier and TypeMethodDescriptionandMetadata(Map<String, String> additionalMetadata) protected StringDescribe the type of message, used inMessageDecorator.toString().withConvertedPayload(Type type, Converter converter) Returns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.withMetadata(Map<String, String> metadata) Returns a copy of thisMessage(implementation) with the givenmetadata.Methods inherited from class org.axonframework.messaging.core.MessageDecorator
delegate, describeTo, identifier, metadata, payload, payloadAs, payloadType, toString, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.core.Message
identifier, metadata, payload, payloadAs, payloadAs, payloadAs, payloadAs, payloadAs, payloadType, typeMethods inherited from interface org.axonframework.messaging.eventhandling.replay.ResetContext
withConvertedPayload, withConvertedPayload
-
Constructor Details
-
GenericResetContext
Constructs aGenericResetContextfor the giventypeandpayload.The
Metadatadefaults to an empty instance.- Parameters:
type- Thetypefor thisResetContext.payload- The payload for thisResetContext.
-
GenericResetContext
public GenericResetContext(@Nonnull MessageType type, @Nullable Object payload, @Nonnull Map<String, String> metadata) Constructs aGenericResetContextfor the giventype,payload, andmetadata.- Parameters:
type- Thetypefor thisResetContext.payload- The payload for thisResetContext.metadata- The metadata for thisResetContext.
-
GenericResetContext
Constructs aGenericResetContextfor the givendelegate, intended to reconstruct anotherResetContext.Unlike the other constructors, this constructor will not attempt to retrieve any correlation data from the Unit of Work.
- Parameters:
delegate- TheMessagecontainingpayload,type,identifierandmetadatafor theEventMessageto reconstruct.
-
-
Method Details
-
withMetadata
Description copied from interface:MessageReturns a copy of thisMessage(implementation) with the givenmetadata.All other fields, like for example the
Message.payload(), remain unchanged.While the implementation returned may be different from the implementation of
this, implementations must take special care in returning the same type ofMessageto prevent errors further downstream.- Specified by:
withMetadatain interfaceMessage- Specified by:
withMetadatain interfaceResetContext- Parameters:
metadata- The new metadata for theMessage.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
andMetadata
Description copied from interface:MessageReturns a copy of thisMessage(implementation) with itsmetadatamerged with the givenmetadata.All other fields, like for example the
Message.payload(), remain unchanged.- Specified by:
andMetadatain interfaceMessage- Specified by:
andMetadatain interfaceResetContext- Parameters:
additionalMetadata- The metadata to merge with.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
withConvertedPayload
Description copied from interface:MessageReturns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter. This newMessageis effectively a copy ofthis Messagewith a renewed payload andMessage.payloadType().Will return the
thisinstance if thepayload typeisassignable fromthe converted result.- Specified by:
withConvertedPayloadin interfaceMessage- Specified by:
withConvertedPayloadin interfaceResetContext- Overrides:
withConvertedPayloadin classMessageDecorator- Parameters:
type- The type to convert theMessage.payload()to.converter- The converter to convert theMessage.payload()with.- Returns:
- A new
Messageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.
-
describeType
Description copied from class:MessageDecoratorDescribe the type of message, used inMessageDecorator.toString().Defaults to the simple class name of the actual instance.
- Overrides:
describeTypein classMessageDecorator- Returns:
- The type of the message.
-