Package org.axonframework.eventhandling
Class GenericTrackedEventMessage<T>
java.lang.Object
org.axonframework.messaging.MessageDecorator<T>
org.axonframework.eventhandling.GenericEventMessage<T>
org.axonframework.eventhandling.GenericTrackedEventMessage<T>
- Type Parameters:
T- The type of payload contained in this Message
- All Implemented Interfaces:
Serializable,EventMessage<T>,TrackedEventMessage<T>,Message<T>
public class GenericTrackedEventMessage<T>
extends GenericEventMessage<T>
implements TrackedEventMessage<T>
Generic implementation of a
TrackedEventMessage.- See Also:
-
Field Summary
Fields inherited from class org.axonframework.eventhandling.GenericEventMessage
clock -
Constructor Summary
ConstructorsModifierConstructorDescriptionGenericTrackedEventMessage(TrackingToken trackingToken, EventMessage<T> delegate) Creates a GenericTrackedEventMessage with giventrackingTokenand delegate event message.protectedGenericTrackedEventMessage(TrackingToken trackingToken, Message<T> delegate, Instant timestamp) Initializes aGenericTrackedEventMessagewith given message as delegate and giventimestamp.GenericTrackedEventMessage(TrackingToken trackingToken, Message<T> delegate, Supplier<Instant> timestamp) Creates a GenericTrackedEventMessage with giventrackingTokenand delegate event message. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.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.GenericEventMessage
andMetaData, asEventMessage, getTimestamp, withMetaDataMethods 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
andMetaData, getIdentifier, getTimestamp, withMetaDataMethods inherited from interface org.axonframework.messaging.Message
getMetaData, getPayload, getPayloadType, serializeMetaData, serializePayload
-
Constructor Details
-
GenericTrackedEventMessage
Creates a GenericTrackedEventMessage with giventrackingTokenand delegate event message.- Parameters:
trackingToken- tracking token of the eventdelegate- delegate message containing payload, metadata, identifier and timestamp
-
GenericTrackedEventMessage
public GenericTrackedEventMessage(TrackingToken trackingToken, Message<T> delegate, Supplier<Instant> timestamp) Creates a GenericTrackedEventMessage with giventrackingTokenand delegate event message. The timestamp of the event is supplied lazily to prevent unnecessary deserialization of the timestamp.- Parameters:
trackingToken- tracking token of the eventdelegate- delegate message containing payload, metadata, identifier and timestamptimestamp- supplier of the message's timestamp
-
GenericTrackedEventMessage
protected GenericTrackedEventMessage(TrackingToken trackingToken, Message<T> delegate, Instant timestamp) Initializes aGenericTrackedEventMessagewith given message as delegate and giventimestamp. The given message will be used supply the payload, metadata and identifier of the resulting event message.- Parameters:
trackingToken- the tracking token of the resulting messagedelegate- the message that will be used used as delegatetimestamp- the timestamp of the resulting event message
-
-
Method Details
-
trackingToken
Description copied from interface:TrackedEventMessageReturns theTrackingTokenof the event message.- Specified by:
trackingTokenin interfaceTrackedEventMessage<T>- Returns:
- the tracking token of the event
-
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 classGenericEventMessage<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 classGenericEventMessage<T>- Returns:
- the type of message
-