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, startpublic 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
Servicestop in interface Servicestop in class DefaultUnitOfWorkException - is thrown if stopping failedpublic void pushRouteContext(RouteContext routeContext)
UnitOfWorkRouteContext 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 UnitOfWorkpushRouteContext in class DefaultUnitOfWorkrouteContext - the route contextpublic RouteContext popRouteContext()
UnitOfWorkRouteContext
it should be removed.popRouteContext in interface UnitOfWorkpopRouteContext in class DefaultUnitOfWorkpublic void beginTransactedBy(Object key)
UnitOfWorkUnitOfWork.endTransactedBy(Object) method using the same key.beginTransactedBy in interface UnitOfWorkbeginTransactedBy in class DefaultUnitOfWorkkey - the transaction keypublic void endTransactedBy(Object key)
UnitOfWorkendTransactedBy in interface UnitOfWorkendTransactedBy in class DefaultUnitOfWorkkey - the transaction keypublic AsyncCallback beforeProcess(Processor processor, Exchange exchange, AsyncCallback callback)
UnitOfWorkMDCUnitOfWork leverages this
to ensure MDC is handled correctly during routing exchanges using the
asynchronous routing engine.beforeProcess in interface UnitOfWorkbeforeProcess in class DefaultUnitOfWorkprocessor - the processor to be executedexchange - the current exchangecallback - the callbackpublic void afterProcess(Processor processor, Exchange exchange, AsyncCallback callback, boolean doneSync)
UnitOfWorkafterProcess in interface UnitOfWorkafterProcess in class DefaultUnitOfWorkprocessor - the processor executedexchange - the current exchangecallback - the callback useddoneSync - whether the process was done synchronously or asynchronouslypublic void clear()
MDCUnitOfWorkpublic String toString()
toString in class DefaultUnitOfWorkApache Camel