} else {
target = unitOfWorkProcessor;
}
// wrap in route inflight processor to track number of inflight exchanges for the route
RouteInflightRepositoryProcessor inflight = new RouteInflightRepositoryProcessor(camelContext.getInflightRepository(), target);
// and wrap it by a instrumentation processor that is to be used for performance stats
// for this particular route
InstrumentationProcessor instrument = new InstrumentationProcessor();
instrument.setType("route");
instrument.setProcessor(inflight);
// and create the route that wraps the UoW
Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(), instrument);
// create the route id
String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());
edcr.getProperties().put(Route.ID_PROPERTY, routeId);
edcr.getProperties().put(Route.PARENT_PROPERTY, Integer.toHexString(route.hashCode()));
if (route.getGroup() != null) {
edcr.getProperties().put(Route.GROUP_PROPERTY, route.getGroup());
}
// after the route is created then set the route on the policy processor so we get hold of it
if (routePolicyProcessor != null) {
routePolicyProcessor.setRoute(edcr);
}
// after the route is created then set the route on the inflight processor so we get hold of it
inflight.setRoute(edcr);
// invoke init on route policy
if (routePolicyList != null && !routePolicyList.isEmpty()) {
for (RoutePolicy policy : routePolicyList) {
policy.onInit(edcr);