private boolean addTargets(CamelContext camelContext) throws CamelException { for (String routeId : routeIds) { try { Mina2Consumer consumer = (Mina2Consumer) camelContext.getRoute(routeId).getConsumer(); Hl7v2Interceptor interceptor = (Hl7v2Interceptor) consumer.getProcessor(); while (!(interceptor instanceof ConsumerStringProcessingInterceptor)) { interceptor = (Hl7v2Interceptor) interceptor.getWrappedProcessor(); } LOG.debug("Adding MLLP transaction route {} to dispatcher", routeId); map.put(routeId, (Hl7v2Interceptor) interceptor.getWrappedProcessor()); } catch (NullPointerException e) { throw new CamelException( "Route with ID='" + routeId + "' not found or is not an IPF MLLP route", e); } catch (ClassCastException e) { throw new CamelException("Route with ID='" + routeId + "' is not an IPF MLLP route", e); } } return !map.isEmpty(); }