Class MessageOriginProvider
java.lang.Object
org.axonframework.messaging.core.correlation.MessageOriginProvider
- All Implemented Interfaces:
CorrelationDataProvider
A
CorrelationDataProvider implementation that provides the identifier of a
Message to other Messages that are created as result of processing the given message.
By defaults uses the DEFAULT_CORRELATION_KEY as the metadata key for the
"correlation identifier," which refers to the original message identifier starting the
entire business transaction / workflow. The DEFAULT_CAUSATION_KEY is used as the
metadata key for the "causation identifier," referring to the
message identifier preceding it.
- Since:
- 3.0.0
- Author:
- Rene de Waele
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes aMessageOriginProviderusing theDEFAULT_CORRELATION_KEYandDEFAULT_CAUSATION_KEYas thecorrelationKeyandcausationKeyrespectively.MessageOriginProvider(String correlationKey, String causationKey) 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.
-
Field Details
-
DEFAULT_CORRELATION_KEY
- See Also:
-
DEFAULT_CAUSATION_KEY
- See Also:
-
-
Constructor Details
-
MessageOriginProvider
public MessageOriginProvider()Initializes aMessageOriginProviderusing theDEFAULT_CORRELATION_KEYandDEFAULT_CAUSATION_KEYas thecorrelationKeyandcausationKeyrespectively. -
MessageOriginProvider
Initializes aMessageOriginProviderthat uses the givencorrelationKey.- Parameters:
correlationKey- The key used to store the identifier of the originalMessagegiving rise to the currentMessage.causationKey- The key used to store the identifier of aMessagein theMessage.metadata()of a resultingMessage.
-
-
Method Details
-
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.
-