org.axonframework.correlation
Class CorrelationDataHolder

java.lang.Object
  extended by org.axonframework.correlation.CorrelationDataHolder

public final class CorrelationDataHolder
extends Object

DataHolder for meta data entries that need to be attached to messages being generated by this thread. Infrastructure components that send messages to a CommandBus or an EventBus should check this data holder for correlation data to attach to these messages.

Since:
2.3
Author:
Allard Buijze
See Also:
EventTemplate, DefaultCommandGateway, GatewayProxyFactory, CorrelationDataProvider

Method Summary
static void clear()
          Clears the correlation data from the current thread.
static Map<String,?> getCorrelationData()
          Returns the correlation data attached to the current thread.
static void setCorrelationData(Map<String,?> data)
          Attaches the given data as correlation data to the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCorrelationData

public static Map<String,?> getCorrelationData()
Returns the correlation data attached to the current thread. If no correlation data is available, this method returns an empty Map.

Returns:
the correlation data attached to the current thread

setCorrelationData

public static void setCorrelationData(Map<String,?> data)
Attaches the given data as correlation data to the current thread. Any data already attached is replaced with given data.

Note that you should call clear() to remove attached values when exiting the execution scope in which the correlation data is value. Failure to do so may result in memory leaks or faulty correlation data on messages.

Parameters:
data - the correlation data to attach to the current thread

clear

public static void clear()
Clears the correlation data from the current thread.



Copyright © 2010-2016. All Rights Reserved.