Class GenericDeadlineMessage
- All Implemented Interfaces:
DeadlineMessage,Message,EventMessage
DeadlineMessage interface.- Since:
- 3.3.0
- Author:
- Milan Savic, Steven van Beelen
-
Field Summary
Fields inherited from interface org.axonframework.messaging.core.Message
RESOURCE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionGenericDeadlineMessage(String deadlineName, String identifier, MessageType type, @Nullable Object payload, Map<String, String> metadata, Instant timestamp) Constructs aGenericDeadlineMessagefor the givendeadlineName,identifier,type,payload,metadata, andtimestamp.GenericDeadlineMessage(String deadlineName, Message delegate, Supplier<Instant> timestampSupplier) Constructs aGenericDeadlineMessagefor the givendeadlineName,delegateandtimestampSupplier, intended to reconstruct anotherDeadlineMessage.GenericDeadlineMessage(String deadlineName, MessageType type, @Nullable Object payload) Constructs aGenericDeadlineMessagefor the givendeadlineName,type, andpayload.GenericDeadlineMessage(String deadlineName, MessageType type, @Nullable Object payload, Map<String, String> metadata) Constructs aGenericDeadlineMessagefor the givendeadlineName,type,payload, andmetadata.GenericDeadlineMessage(MessageType type, String deadlineName) Constructs aGenericDeadlineMessagefor the giventypeanddeadlineName. -
Method Summary
Modifier and TypeMethodDescriptionandMetadata(Map<String, String> additionalMetadata) static DeadlineMessageasDeadlineMessage(String deadlineName, @Nullable Object messageOrPayload) Deprecated.static DeadlineMessageasDeadlineMessage(String deadlineName, @Nullable Object messageOrPayload, Instant expiryTime) Returns the givendeadlineNameandmessageOrPayloadas a DeadlineMessage which expires at the givenexpiryTime.protected StringDescribe the type of message, used inMessageDecorator.toString().Returns the name of thedeadlineto be handled.withConvertedPayload(Type type, Converter converter) Returns a newMessageimplementation with itsMessage.payload()converted to the giventypeby the givenconverter.withConverter(@Nullable Converter converter) Returns a newGenericDeadlineMessagewith the same properties as this message, including its deadline name, and the givenconverterset for use inMessageDecorator.payloadAs(Class).withMetadata(Map<String, String> metadata) Returns a copy of thisMessage(implementation) with the givenmetadata.Methods inherited from class org.axonframework.messaging.eventhandling.GenericEventMessage
describeTo, timestampMethods inherited from class org.axonframework.messaging.core.MessageDecorator
delegate, identifier, metadata, payload, payloadAs, payloadAs, 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.deadline.DeadlineMessage
withConvertedPayload, withConvertedPayloadMethods inherited from interface org.axonframework.messaging.eventhandling.EventMessage
identifier, timestamp
-
Constructor Details
-
GenericDeadlineMessage
Constructs aGenericDeadlineMessagefor the giventypeanddeadlineName.The
MessageDecorator.payload()defaults tonulland theMetadatadefaults to an empty instance.- Parameters:
type- thetypefor thisDeadlineMessagedeadlineName- the name for thisDeadlineMessage
-
GenericDeadlineMessage
Constructs aGenericDeadlineMessagefor the givendeadlineName,type, andpayload.The
Metadatadefaults to an empty instance.- Parameters:
deadlineName- the name for thisDeadlineMessagetype- thetypefor thisDeadlineMessagepayload- the payload for thisDeadlineMessage
-
GenericDeadlineMessage
public GenericDeadlineMessage(String deadlineName, MessageType type, @Nullable Object payload, Map<String, String> metadata) Constructs aGenericDeadlineMessagefor the givendeadlineName,type,payload, andmetadata.- Parameters:
deadlineName- the name for thisDeadlineMessagetype- thetypefor thisDeadlineMessagepayload- the payload for thisDeadlineMessagemetadata- the metadata for thisDeadlineMessage
-
GenericDeadlineMessage
public GenericDeadlineMessage(String deadlineName, String identifier, MessageType type, @Nullable Object payload, Map<String, String> metadata, Instant timestamp) Constructs aGenericDeadlineMessagefor the givendeadlineName,identifier,type,payload,metadata, andtimestamp.- Parameters:
deadlineName- the name for thisDeadlineMessageidentifier- the identifier of thisDeadlineMessagetype- thetypefor thisDeadlineMessagepayload- the payload for thisDeadlineMessagemetadata- the metadata for thisDeadlineMessagetimestamp- thetimestampof thisDeadlineMessage'screation
-
GenericDeadlineMessage
public GenericDeadlineMessage(String deadlineName, Message delegate, Supplier<Instant> timestampSupplier) Constructs aGenericDeadlineMessagefor the givendeadlineName,delegateandtimestampSupplier, intended to reconstruct anotherDeadlineMessage.The timestamp of the deadline is supplied lazily through the given
timestampSupplierto prevent unnecessary deserialization of the timestamp.- Parameters:
deadlineName- the name for thisDeadlineMessagedelegate- theMessagecontainingpayload,type,identifierandmetadatafor theDeadlineMessageto reconstructtimestampSupplier-Supplierfor thetimestampof theDeadlineMessage'screation
-
-
Method Details
-
asDeadlineMessage
@Deprecated public static DeadlineMessage asDeadlineMessage(String deadlineName, @Nullable Object messageOrPayload) Deprecated.useasDeadlineMessage(String, Object, Instant)instead, as it sets the timestamp of the deadline, rather than the current timeReturns the givendeadlineNameandmessageOrPayloadas a DeadlineMessage. If themessageOrPayloadparameter is of typeMessage, a new DeadlineMessage will be created using the payload and metadata of the given message. Otherwise, the givenmessageOrPayloadis wrapped into a GenericDeadlineMessage as its payload.- Parameters:
deadlineName- the name for the resultingDeadlineMessagemessageOrPayload- aMessageor payload to wrap as a DeadlineMessage- Returns:
- a DeadlineMessage using the
deadlineNameas its deadline name and containing the givenmessageOrPayloadas the payload
-
asDeadlineMessage
public static DeadlineMessage asDeadlineMessage(String deadlineName, @Nullable Object messageOrPayload, Instant expiryTime) Returns the givendeadlineNameandmessageOrPayloadas a DeadlineMessage which expires at the givenexpiryTime. If themessageOrPayloadparameter is of typeMessage, a newDeadlineMessageinstance will be created using the payload and metadata of the given message. Otherwise, the givenmessageOrPayloadis wrapped into aGenericDeadlineMessageas its payload, with aMessageTyperesolved from the payload's class.- Parameters:
deadlineName- the name for the resultingDeadlineMessagemessageOrPayload- aMessageor payload to wrap as a DeadlineMessageexpiryTime- the timestamp at which the deadline expires- Returns:
- a DeadlineMessage using the
deadlineNameas its deadline name and containing the givenmessageOrPayloadas the payload
-
getDeadlineName
Description copied from interface:DeadlineMessageReturns the name of thedeadlineto be handled.- Specified by:
getDeadlineNamein interfaceDeadlineMessage- Returns:
- the name of the
deadline
-
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 interfaceDeadlineMessage- Specified by:
withMetadatain interfaceEventMessage- Specified by:
withMetadatain interfaceMessage- Overrides:
withMetadatain classGenericEventMessage- 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 interfaceDeadlineMessage- Specified by:
andMetadatain interfaceEventMessage- Specified by:
andMetadatain interfaceMessage- Overrides:
andMetadatain classGenericEventMessage- 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 interfaceDeadlineMessage- Specified by:
withConvertedPayloadin interfaceEventMessage- Specified by:
withConvertedPayloadin interfaceMessage- Overrides:
withConvertedPayloadin classGenericEventMessage- 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.
-
withConverter
Returns a newGenericDeadlineMessagewith the same properties as this message, including its deadline name, and the givenconverterset for use inMessageDecorator.payloadAs(Class).- Overrides:
withConverterin classGenericEventMessage- Parameters:
converter- the converter for the new message- Returns:
- a copy of this instance with the converter set
-
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 classGenericEventMessage- Returns:
- The type of the message.
-
asDeadlineMessage(String, Object, Instant)instead, as it sets the timestamp of the deadline, rather than the current time