Interface SyntheticBacklogTracer
- All Superinterfaces:
BacklogTracer
Extended
BacklogTracer API for components that process exchanges inline and bypass the normal route pipeline
(e.g. mock mode in the rest-openapi consumer). Such components cannot rely on the automatic tracing that
CamelInternalProcessor applies to every node in the route graph, so they must emit synthetic first/last trace
events manually to participate in message-history capture.
Callers obtain a SyntheticBacklogTracer from the context plugin manager and guard on null before invoking the
synthetic tracing methods:
SyntheticBacklogTracer tracer = camelContext.getCamelContextExtension().getContextPlugin(SyntheticBacklogTracer.class);
if (tracer != null && (tracer.isEnabled() || tracer.isStandby())) {
tracer.traceFirstNode(node, exchange);
}
try {
// ... inline processing ...
} finally {
if (tracer != null && (tracer.isEnabled() || tracer.isStandby())) {
tracer.traceLastNode(node, exchange);
}
}
- Since:
- 4.21
-
Method Summary
Modifier and TypeMethodDescriptionvoidtraceFirstNode(NamedNode node, Exchange exchange) Emits a synthetic first trace event (first=true, last=false) for the given node and exchange.voidtraceLastNode(NamedNode node, Exchange exchange) Emits a synthetic last trace event (first=false, last=true) for the given node and exchange.Methods inherited from interface BacklogTracer
clear, dumpAllTracedMessages, dumpAllTracedMessagesAsJSon, dumpAllTracedMessagesAsXml, dumpLatestMessageHistory, dumpLatestMessageHistoryAsJSon, dumpLatestMessageHistoryAsXml, dumpTracedMessages, dumpTracedMessagesAsJSon, dumpTracedMessagesAsXml, getAllTracedMessages, getBacklogSize, getBodyMaxChars, getLatestMessageHistory, getQueueSize, getTraceCounter, getTraceFilter, getTracePattern, incrementTraceCounter, isBodyIncludeFiles, isBodyIncludeStreams, isEnabled, isIncludeException, isIncludeExchangeProperties, isIncludeExchangeVariables, isRemoveOnDump, isStandby, isTraceRests, isTraceTemplates, resetTraceCounter, setBacklogSize, setBodyIncludeFiles, setBodyIncludeStreams, setBodyMaxChars, setEnabled, setIncludeException, setIncludeExchangeProperties, setIncludeExchangeVariables, setRemoveOnDump, setStandby, setTraceFilter, setTracePattern, setTraceRests, setTraceTemplates, shouldTrace, traceEvent
-
Method Details
-
traceFirstNode
Emits a synthetic first trace event (first=true, last=false) for the given node and exchange.Call this before the inline processing begins. It pairs with
traceLastNode(NamedNode, Exchange)to bracket the operation, mirroring whatBacklogTracerRouteAdvicedoes automatically for normal route nodes.- Parameters:
node- the synthetic node representing the inline operationexchange- the current exchange- Since:
- 4.21
-
traceLastNode
Emits a synthetic last trace event (first=false, last=true) for the given node and exchange.Call this after the inline processing completes (typically in a
finallyblock). Thelast=trueflag triggers message-history completion in the tracer, making the exchange visible in the history view.- Parameters:
node- the synthetic node representing the inline operationexchange- the current exchange- Since:
- 4.21
-