Class SimpleCorrelationDataProvider

java.lang.Object
org.axonframework.messaging.core.correlation.SimpleCorrelationDataProvider
All Implemented Interfaces:
CorrelationDataProvider

public class SimpleCorrelationDataProvider extends Object implements CorrelationDataProvider
A CorrelationDataProvider implementation that defines correlation data by the
invalid reference
Message#metaData()
key names.

The metadata entries from messages matching these keys are returned as correlation data.

Since:
2.3.0
Author:
Allard Buijze
  • Constructor Details

    • SimpleCorrelationDataProvider

      public SimpleCorrelationDataProvider(String... metadataKeys)
      Initializes a SimpleCorrelationDataProvider that returns the Message.metadata() entries of given messages that match the given metadataKeys as correlation data.
      Parameters:
      metadataKeys - The keys of the Message.metadata() entries from messages to return as correlation data.
  • Method Details

    • correlationDataFor

      @Nonnull public Map<String,String> correlationDataFor(@Nonnull Message message)
      Description copied from interface: CorrelationDataProvider
      Provides a map with the entries to attach as correlation data to generated messages while processing given message.

      This method should not return null. 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:
      correlationDataFor in interface CorrelationDataProvider
      Parameters:
      message - The message to define correlation data for.
      Returns:
      The data to attach as correlation data to generated messages.