Class MessageOriginProvider
java.lang.Object
org.axonframework.messaging.correlation.MessageOriginProvider
- All Implemented Interfaces:
CorrelationDataProvider
CorrelationDataProvider that provides the
identifier of a Message to
other messages that are created as result of processing the first message.- Author:
- Rene de Waele
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes aMessageOriginProviderthat uses the default correlation id key:getDefaultCorrelationKey()and trace id key:getDefaultTraceKey().MessageOriginProvider(String correlationKey, String traceKey) Initializes aMessageOriginProviderthat uses the givencorrelationKey. -
Method Summary
Modifier and TypeMethodDescriptioncorrelationDataFor(Message<?> message) Provides a map with the entries to attach as correlation data to generated messages while processing givenmessage.static StringReturns the default metadata key for the correlation id of a message.static StringReturns the default metadata key for the trace id of a message.
-
Constructor Details
-
MessageOriginProvider
public MessageOriginProvider()Initializes aMessageOriginProviderthat uses the default correlation id key:getDefaultCorrelationKey()and trace id key:getDefaultTraceKey(). -
MessageOriginProvider
Initializes aMessageOriginProviderthat uses the givencorrelationKey.- Parameters:
correlationKey- the key used to store the identifier of a message in the metadata of a resulting messagetraceKey- the key used to store the identifier of the original message giving rise to the current message
-
-
Method Details
-
getDefaultCorrelationKey
Returns the default metadata key for the correlation id of a message.- Returns:
- the default metadata key for the correlation id
-
getDefaultTraceKey
Returns the default metadata key for the trace id of a message.- Returns:
- the default metadata key for the trace id
-
correlationDataFor
Description copied from interface:CorrelationDataProviderProvides a map with the entries to attach as correlation data to generated messages while processing givenmessage. This method should not returnnull. Any exception thrown from this method might interfere with rolling back a transaction. Therefore, by default exceptions are caught, ignoring the correlation data that should have been added.- Specified by:
correlationDataForin interfaceCorrelationDataProvider- Parameters:
message- The message to define correlation data for- Returns:
- the data to attach as correlation data to generated messages
-