Package org.axonframework.deadline
Class GenericDeadlineMessage<T>
java.lang.Object
org.axonframework.messaging.MessageDecorator<T>
org.axonframework.eventhandling.GenericEventMessage<T>
org.axonframework.deadline.GenericDeadlineMessage<T>
- Type Parameters:
T- The type of payload contained in this Message
- All Implemented Interfaces:
Serializable,DeadlineMessage<T>,EventMessage<T>,Message<T>
Generic implementation of the
DeadlineMessage.- Since:
- 3.3
- Author:
- Milan Savic, Steven van Beelen
- See Also:
-
Field Summary
Fields inherited from class org.axonframework.eventhandling.GenericEventMessage
clock -
Constructor Summary
ConstructorsConstructorDescriptionGenericDeadlineMessage(String deadlineName) Instantiate a GenericDeadlineMessage with the givendeadlineName, anullpayload and en emptyMetaData.GenericDeadlineMessage(String deadlineName, String identifier, T payload, Map<String, ?> metaData, Instant timestamp) Constructor to reconstructs a DeadlineMessage using existing data.GenericDeadlineMessage(String deadlineName, Message<T> delegate, Supplier<Instant> timestampSupplier) Constructor to reconstruct a DeadlineMessage using existing data.GenericDeadlineMessage(String deadlineName, T payload) Instantiate a GenericDeadlineMessage with the givendeadlineName, apayloadof typeTand en emptyMetaData.GenericDeadlineMessage(String deadlineName, T payload, Map<String, ?> metaData) Instantiate a GenericDeadlineMessage with the givendeadlineName, apayloadof typeTand the givenmetaData. -
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> additionalMetaData) Returns a copy of this EventMessage with it MetaData merged with the givenmetaData.static <T> DeadlineMessage<T> asDeadlineMessage(String deadlineName, Object messageOrPayload) Deprecated.static <T> DeadlineMessage<T> asDeadlineMessage(String deadlineName, Object messageOrPayload, Instant expiryTime) Returns the givendeadlineNameandmessageOrPayloadas a DeadlineMessage which expires at the givenexpiryTime.protected StringDescribe the type of message, used inMessageDecorator.toString().Retrieve aStringrepresenting the name of this DeadlineMessage.withMetaData(Map<String, ?> metaData) Returns a copy of this EventMessage with the givenmetaData.Methods inherited from class org.axonframework.eventhandling.GenericEventMessage
asEventMessage, describeTo, getTimestampMethods inherited from class org.axonframework.messaging.MessageDecorator
getDelegate, getIdentifier, getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.eventhandling.EventMessage
getIdentifier, getTimestampMethods inherited from interface org.axonframework.messaging.Message
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Constructor Details
-
GenericDeadlineMessage
Instantiate a GenericDeadlineMessage with the givendeadlineName, anullpayload and en emptyMetaData.- Parameters:
deadlineName- AStringdenoting the deadline's name
-
GenericDeadlineMessage
Instantiate a GenericDeadlineMessage with the givendeadlineName, apayloadof typeTand en emptyMetaData.- Parameters:
deadlineName- AStringdenoting the deadline's namepayload- The payload of typeTfor the DeadlineMessage
-
GenericDeadlineMessage
public GenericDeadlineMessage(@Nonnull String deadlineName, @Nullable T payload, @Nonnull Map<String, ?> metaData) Instantiate a GenericDeadlineMessage with the givendeadlineName, apayloadof typeTand the givenmetaData.- Parameters:
deadlineName- AStringdenoting the deadline's namepayload- The payload of the MessagemetaData- The MetaData of the Message
-
GenericDeadlineMessage
public GenericDeadlineMessage(@Nonnull String deadlineName, @Nonnull String identifier, @Nullable T payload, Map<String, ?> metaData, Instant timestamp) Constructor to reconstructs a DeadlineMessage using existing data. -
GenericDeadlineMessage
public GenericDeadlineMessage(@Nonnull String deadlineName, @Nonnull Message<T> delegate, @Nonnull Supplier<Instant> timestampSupplier) Constructor to reconstruct a DeadlineMessage using existing data. The timestamp of the event is supplied lazily to prevent unnecessary deserialization of the timestamp.
-
-
Method Details
-
asDeadlineMessage
@Deprecated public static <T> DeadlineMessage<T> asDeadlineMessage(@Nonnull String deadlineName, 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 meta data of the given deadline. Otherwise, the givenmessageOrPayloadis wrapped into a GenericDeadlineMessage as its payload.- Type Parameters:
T- The generic type of the expected payload of the resulting object- Parameters:
deadlineName- AStringdenoting the deadline's namemessageOrPayload- 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 <T> DeadlineMessage<T> asDeadlineMessage(@Nonnull String deadlineName, @Nullable Object messageOrPayload, @Nonnull 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 meta data of the given message. Otherwise, the givenmessageOrPayloadis wrapped into aGenericDeadlineMessageas its payload.- Type Parameters:
T- The generic type of the expected payload of the resulting object- Parameters:
deadlineName- AStringdenoting the deadline's namemessageOrPayload- 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:DeadlineMessageRetrieve aStringrepresenting the name of this DeadlineMessage.- Specified by:
getDeadlineNamein interfaceDeadlineMessage<T>- Returns:
- a
Stringrepresenting the name of this DeadlineMessage
-
withMetaData
Description copied from interface:EventMessageReturns a copy of this EventMessage with the givenmetaData. The payload,TimestampandIdentifierremain unchanged.- Specified by:
withMetaDatain interfaceDeadlineMessage<T>- Specified by:
withMetaDatain interfaceEventMessage<T>- Specified by:
withMetaDatain interfaceMessage<T>- Overrides:
withMetaDatain classGenericEventMessage<T>- Parameters:
metaData- The new MetaData for the Message- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Description copied from interface:EventMessageReturns a copy of this EventMessage with it MetaData merged with the givenmetaData. The payload,TimestampandIdentifierremain unchanged.- Specified by:
andMetaDatain interfaceDeadlineMessage<T>- Specified by:
andMetaDatain interfaceEventMessage<T>- Specified by:
andMetaDatain interfaceMessage<T>- Overrides:
andMetaDatain classGenericEventMessage<T>- Parameters:
additionalMetaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-
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<T>- Returns:
- the type of message
-
asDeadlineMessage(String, Object, Instant)instead, as it sets the timestamp of the deadline, rather than the current time