I have created a interceptor added to the context.This interceptor is getting
executed for each node in the route.But i want to identify when processing
of all nodes is complete and do some action.

 public class MyInterceptStrategy implements InterceptStrategy {

public int count = 0;

@Override
public Processor wrapProcessorInInterceptors(final CamelContext context,
        final ProcessorDefinition<?> definition, final Processor target,
        final Processor nextTarget) throws Exception {
    return new DelegateAsyncProcessor(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
            count++;
            target.process(exchange);
            //if this is the last node print the message "all nodes
processed" and count is "count"
            //System.out.println(count);
        }
    }) {

    };

}
}

UPDATE:Tried doing this to get the total count of nodes,but this returns all
the nodes in all the routes and not just the nodes that are eligible for
processing.

public int getTotalProcessors(CamelContext context) {
    int totalProcessorsCount = 0;
    for (Route r : context.getRoutes()) {
        totalProcessorsCount = totalProcessorsCount +
r.getRouteContext().getRoute().getOutputs().size();
    }
    return totalProcessorsCount;
}



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-identify-whether-all-nodes-are-processed-tp5768169.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to