public class ErrorHandler extends LoadBalancerSupport {
	private static final Logger logger = LoggerFactory.getLogger(ErrorHandler.class);
	static int NUM_PROCESSORS = 2;
	int which = 0;
	 
    public boolean process(Exchange exchange, AsyncCallback callback) {
        String body = exchange.getIn().getBody(String.class);
        logger.info("ErrorHandler: got message:"+ body);
        System.out.println("ErrorHandler: got message:"+ body);
        try {
        	logger.info("ErrorHandler: going to:"+which+" processor");
        	System.out.println("ErrorHandler: going to:"+which+" processor");
        	getProcessors().get(which).process(exchange);
        } catch (Throwable e) {
        	logger.info("ErrorHandler: caught an exception:"+e.getMessage());
        	System.out.println("ErrorHandler: caught an exception:"+e.getMessage());
        	which = (++which) % NUM_PROCESSORS;
            exchange.setException(e);
        }
        callback.done(true);
        return true;
    }