// force the creation of an id
RouteDefinitionHelper.forceAssignIds(routeContext.getCamelContext(), definition);
// first wrap the output with the managed strategy if any
InterceptStrategy managed = routeContext.getManagedInterceptStrategy();
if (managed != null) {
next = target == nextProcessor ? null : nextProcessor;
target = managed.wrapProcessorInInterceptors(routeContext.getCamelContext(), targetOutputDef, target, next);
}
// then wrap the output with the backlog and tracer (backlog first, as we do not want regular tracer to tracer the backlog)
InterceptStrategy tracer = getOrCreateBacklogTracer();
camelContext.addService(tracer);
if (tracer instanceof BacklogTracer) {
BacklogTracer backlogTracer = (BacklogTracer) tracer;
RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition);
boolean first = false;
if (route != null && !route.getOutputs().isEmpty()) {
first = route.getOutputs().get(0) == definition;
}
addAdvice(new BacklogTracerAdvice(backlogTracer.getQueue(), backlogTracer, targetOutputDef, route, first));
// add debugger as well so we have both tracing and debugging out of the box
InterceptStrategy debugger = getOrCreateBacklogDebugger();
camelContext.addService(debugger);
if (debugger instanceof BacklogDebugger) {
BacklogDebugger backlogDebugger = (BacklogDebugger) debugger;
addAdvice(new BacklogDebuggerAdvice(backlogDebugger, target, targetOutputDef));
}