public class MDCUnitOfWork extends DefaultUnitOfWork
Modifier and Type | Field and Description |
---|---|
static String |
MDC_BREADCRUMB_ID |
static String |
MDC_CAMEL_CONTEXT_ID |
static String |
MDC_CORRELATION_ID |
static String |
MDC_EXCHANGE_ID |
static String |
MDC_MESSAGE_ID |
static String |
MDC_ROUTE_ID |
static String |
MDC_TRANSACTION_KEY |
Constructor and Description |
---|
MDCUnitOfWork(Exchange exchange) |
Modifier and Type | Method and Description |
---|---|
void |
afterProcess(Processor processor,
Exchange exchange,
AsyncCallback callback,
boolean doneSync)
Strategy for optional work to be executed after the processing
|
AsyncCallback |
beforeProcess(Processor processor,
Exchange exchange,
AsyncCallback callback)
Strategy for optional work to be execute before processing
For example the
MDCUnitOfWork leverages this
to ensure MDC is handled correctly during routing exchanges using the
asynchronous routing engine. |
void |
beginTransactedBy(Object key)
Mark this UnitOfWork as being transacted by the given transaction key.
|
void |
clear()
Clears information put on the MDC by this
MDCUnitOfWork |
void |
endTransactedBy(Object key)
Mark this UnitOfWork as not transacted anymore by the given transaction definition.
|
UnitOfWork |
newInstance(Exchange exchange) |
RouteContext |
popRouteContext()
When finished being routed under the current
RouteContext
it should be removed. |
void |
pushRouteContext(RouteContext routeContext)
Pushes the
RouteContext that this UnitOfWork currently is being routed through. |
void |
stop()
Stops the service
|
String |
toString() |
addSynchronization, afterRoute, beforeRoute, beginSubUnitOfWork, containsSynchronization, createChildUnitOfWork, done, endSubUnitOfWork, getId, getOriginalInMessage, getRouteContext, getSubUnitOfWorkCallback, getTracedRouteNodes, handoverSynchronization, isTransacted, isTransactedBy, removeSynchronization, setParentUnitOfWork, start
public static final String MDC_BREADCRUMB_ID
public static final String MDC_EXCHANGE_ID
public static final String MDC_MESSAGE_ID
public static final String MDC_CORRELATION_ID
public static final String MDC_ROUTE_ID
public static final String MDC_CAMEL_CONTEXT_ID
public static final String MDC_TRANSACTION_KEY
public MDCUnitOfWork(Exchange exchange)
public UnitOfWork newInstance(Exchange exchange)
public void stop() throws Exception
Service
stop
in interface Service
stop
in class DefaultUnitOfWork
Exception
- is thrown if stopping failedpublic void pushRouteContext(RouteContext routeContext)
UnitOfWork
RouteContext
that this UnitOfWork
currently is being routed through.
Notice that an Exchange
can be routed through multiple routes and thus the
RouteContext
can change over time.pushRouteContext
in interface UnitOfWork
pushRouteContext
in class DefaultUnitOfWork
routeContext
- the route contextpublic RouteContext popRouteContext()
UnitOfWork
RouteContext
it should be removed.popRouteContext
in interface UnitOfWork
popRouteContext
in class DefaultUnitOfWork
public void beginTransactedBy(Object key)
UnitOfWork
UnitOfWork.endTransactedBy(Object)
method using the same key.beginTransactedBy
in interface UnitOfWork
beginTransactedBy
in class DefaultUnitOfWork
key
- the transaction keypublic void endTransactedBy(Object key)
UnitOfWork
endTransactedBy
in interface UnitOfWork
endTransactedBy
in class DefaultUnitOfWork
key
- the transaction keypublic AsyncCallback beforeProcess(Processor processor, Exchange exchange, AsyncCallback callback)
UnitOfWork
MDCUnitOfWork
leverages this
to ensure MDC is handled correctly during routing exchanges using the
asynchronous routing engine.beforeProcess
in interface UnitOfWork
beforeProcess
in class DefaultUnitOfWork
processor
- the processor to be executedexchange
- the current exchangecallback
- the callbackpublic void afterProcess(Processor processor, Exchange exchange, AsyncCallback callback, boolean doneSync)
UnitOfWork
afterProcess
in interface UnitOfWork
afterProcess
in class DefaultUnitOfWork
processor
- the processor executedexchange
- the current exchangecallback
- the callback useddoneSync
- whether the process was done synchronously or asynchronouslypublic void clear()
MDCUnitOfWork
public String toString()
toString
in class DefaultUnitOfWork
Apache Camel