Package org.axonframework.eventhandling
Class GenericTrackedDomainEventMessage<T>
java.lang.Object
org.axonframework.messaging.MessageDecorator<T>
org.axonframework.eventhandling.GenericEventMessage<T>
org.axonframework.eventhandling.GenericDomainEventMessage<T>
org.axonframework.eventhandling.GenericTrackedDomainEventMessage<T>
- Type Parameters:
T- The type of payload contained in this Message
- All Implemented Interfaces:
Serializable,DomainEventMessage<T>,EventMessage<T>,TrackedEventMessage<T>,Message<T>
public class GenericTrackedDomainEventMessage<T>
extends GenericDomainEventMessage<T>
implements TrackedEventMessage<T>
Generic implementation of a
DomainEventMessage that is also a TrackedEventMessage.- See Also:
-
Field Summary
Fields inherited from class org.axonframework.eventhandling.GenericEventMessage
clock -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Instant timestamp) Initialize a DomainEventMessage originating from an aggregate.GenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Supplier<Instant> timestamp) Initialize a DomainEventMessage originating from an Aggregate using existing data.GenericTrackedDomainEventMessage(TrackingToken trackingToken, DomainEventMessage<T> delegate) Initialize a DomainEventMessage originating from an aggregate. -
Method Summary
Modifier and TypeMethodDescriptionandMetaData(Map<String, ?> metaData) Returns a copy of this EventMessage with it MetaData merged with the givenmetaData.protected voiddescribeTo(StringBuilder stringBuilder) Describe the message specific properties to the givenstringBuilder.protected StringDescribe the type of message, used inMessageDecorator.toString().Returns theTrackingTokenof the event message.withMetaData(Map<String, ?> metaData) Returns a copy of this EventMessage with the givenmetaData.withTrackingToken(TrackingToken trackingToken) Creates a copy of this message with the giventrackingTokento replace the one in this message.Methods inherited from class org.axonframework.eventhandling.GenericDomainEventMessage
getAggregateIdentifier, getSequenceNumber, getTypeMethods inherited from class org.axonframework.eventhandling.GenericEventMessage
asEventMessage, 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
-
GenericTrackedDomainEventMessage
public GenericTrackedDomainEventMessage(TrackingToken trackingToken, DomainEventMessage<T> delegate) Initialize a DomainEventMessage originating from an aggregate.- Parameters:
trackingToken- Tracking token of the eventdelegate- Delegate domain event containing other event data
-
GenericTrackedDomainEventMessage
public GenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Supplier<Instant> timestamp) Initialize a DomainEventMessage originating from an Aggregate using existing data. The timestamp of the event is supplied lazily to prevent unnecessary deserialization of the timestamp.- Parameters:
trackingToken- Tracking token of the eventtype- The domain typeaggregateIdentifier- The identifier of the aggregate generating this messagesequenceNumber- The message's sequence numberdelegate- The delegate message providing the payload, metadata and identifier of the eventtimestamp- The event's timestamp supplier
-
GenericTrackedDomainEventMessage
protected GenericTrackedDomainEventMessage(TrackingToken trackingToken, String type, String aggregateIdentifier, long sequenceNumber, Message<T> delegate, Instant timestamp) Initialize a DomainEventMessage originating from an aggregate.- Parameters:
trackingToken- Tracking token of the eventtype- The domain typeaggregateIdentifier- The identifier of the aggregate generating this messagesequenceNumber- The message's sequence numberdelegate- The delegate message providing the payload, metadata and identifier of the eventtimestamp- The event's timestamp
-
-
Method Details
-
trackingToken
Description copied from interface:TrackedEventMessageReturns theTrackingTokenof the event message.- Specified by:
trackingTokenin interfaceTrackedEventMessage<T>- Returns:
- the tracking token of the event
-
withMetaData
Description copied from interface:EventMessageReturns a copy of this EventMessage with the givenmetaData. The payload,TimestampandIdentifierremain unchanged.- Specified by:
withMetaDatain interfaceDomainEventMessage<T>- Specified by:
withMetaDatain interfaceEventMessage<T>- Specified by:
withMetaDatain interfaceMessage<T>- Overrides:
withMetaDatain classGenericDomainEventMessage<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 interfaceDomainEventMessage<T>- Specified by:
andMetaDatain interfaceEventMessage<T>- Specified by:
andMetaDatain interfaceMessage<T>- Overrides:
andMetaDatain classGenericDomainEventMessage<T>- Parameters:
metaData- The MetaData to merge with- Returns:
- a copy of this message with the given MetaData
-
describeTo
Description copied from class:MessageDecoratorDescribe the message specific properties to the givenstringBuilder. Subclasses should override this method, calling the super method and appending their own properties to the end (or beginning).As convention, String values should be enclosed in single quotes, Objects in curly brackets and numeric values may be appended without enclosing. All properties should be preceded by a comma when appending, or finish with a comma when prefixing values.
- Overrides:
describeToin classGenericDomainEventMessage<T>- Parameters:
stringBuilder- the builder to append data to
-
withTrackingToken
Description copied from interface:TrackedEventMessageCreates a copy of this message with the giventrackingTokento replace the one in this message.This method is useful in case streams are modified (combined, split), and the tokens of the combined stream are different than the originating stream.
- Specified by:
withTrackingTokenin interfaceTrackedEventMessage<T>- Parameters:
trackingToken- The tracking token to replace- Returns:
- a new instance of a message with a different tracking token
-
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 classGenericDomainEventMessage<T>- Returns:
- the type of message
-