Package org.axonframework.messaging.core
Class AbstractMessage
java.lang.Object
org.axonframework.messaging.core.AbstractMessage
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
GenericMessage
Abstract base class for
Messages.- Since:
- 3.0.0
- Author:
- Rene de Waele, Steven van Beelen
-
Field Summary
Fields inherited from interface org.axonframework.messaging.core.Message
RESOURCE_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandMetadata(Map<String, String> metadata) Returns the identifier of thisMessage.type()Returns the messagetypeof thisMessage.withMetadata(Map<String, String> metadata) Returns a copy of thisMessage(implementation) with the givenmetadata.protected abstract MessagewithMetadata(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.core.Message
metadata, payload, payloadAs, payloadAs, payloadAs, payloadAs, payloadAs, payloadType, withConvertedPayload, withConvertedPayload, withConvertedPayload
-
Constructor Details
-
Method Details
-
identifier
Description copied from interface:MessageReturns the identifier of thisMessage.Two messages with the same identifiers should be interpreted as different representations of the same conceptual message. In such case, the
metadatamay be different for both representations. Thepayloadmay be identical.- Specified by:
identifierin interfaceMessage- Returns:
- The unique identifier of this
Message.
-
type
Description copied from interface:MessageReturns the messagetypeof thisMessage. -
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- 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- Parameters:
metadata- The metadata to merge with.- Returns:
- A copy of
this Message (implementation)with the givenmetadata.
-
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
-