Interface SyntheticBacklogTracer

All Superinterfaces:
BacklogTracer

public interface SyntheticBacklogTracer extends 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 Details

    • traceFirstNode

      void traceFirstNode(NamedNode node, Exchange exchange)
      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 what BacklogTracerRouteAdvice does automatically for normal route nodes.

      Parameters:
      node - the synthetic node representing the inline operation
      exchange - the current exchange
      Since:
      4.21
    • traceLastNode

      void traceLastNode(NamedNode node, Exchange exchange)
      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 finally block). The last=true flag triggers message-history completion in the tracer, making the exchange visible in the history view.

      Parameters:
      node - the synthetic node representing the inline operation
      exchange - the current exchange
      Since:
      4.21