Package org.axonframework.messaging
Class AbstractMessage<T>
java.lang.Object
org.axonframework.messaging.AbstractMessage<T>
- All Implemented Interfaces:
Serializable,Message<T>
- Direct Known Subclasses:
GenericMessage,SerializedMessage
Abstract base class for Messages.
- Author:
- Rene de Waele
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMessage(String identifier) Initializes a new message with given identifier. -
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this Message with it MetaData merged with the givenmetaData.Returns the identifier of this message.withMetaData(Map<String, ?> metaData) Returns a copy of this Message with the givenmetaData.withMetaData(MetaData metaData) Returns a new message instance with the same payload and properties as this message but givenmetaData.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.Message
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Constructor Details
-
AbstractMessage
Initializes a new message with given identifier.- Parameters:
identifier- the message identifier
-
-
Method Details
-
getIdentifier
Description copied from interface:MessageReturns the identifier of this message. Two messages with the same identifiers should be interpreted as different representations of the same conceptual message. In such case, the meta-data may be different for both representations. The payload may be identical.- Specified by:
getIdentifierin interfaceMessage<T>- Returns:
- the unique identifier of this message
-
withMetaData
Description copied from interface:MessageReturns a copy of this Message with the givenmetaData. The payload remains unchanged. While the implementation returned may be different than the implementation ofthis, implementations must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent errors further downstream.- Specified by:
withMetaDatain interfaceMessage<T>- Parameters:
metaData- The new MetaData for the Message- Returns:
- a copy of this message with the given MetaData
-
andMetaData
Description copied from interface:MessageReturns a copy of this Message with it MetaData merged with the givenmetaData. The payload remains unchanged.- Specified by:
andMetaDatain interfaceMessage<T>- Parameters:
metaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-
withMetaData
Returns a new message instance with the same payload and properties as this message but givenmetaData.- Parameters:
metaData- The metadata in the new message- Returns:
- a copy of this instance with given metadata
-