Krzysztof Borgul created CAMEL-12250:
----------------------------------------

             Summary: Interceptors are not working for route with redelivery 
strategy
                 Key: CAMEL-12250
                 URL: https://issues.apache.org/jira/browse/CAMEL-12250
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.20.2
            Reporter: Krzysztof Borgul


Camel interceptors are not being executed if there is redelivery strategy 
defined. 

 Code below will display BEFORE and AFTER text only if you remove errorHandler 
configuration.

 
{code:java}
public static void main(String[] args) throws Exception {
    DefaultCamelContext context = new DefaultCamelContext();
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            errorHandler(new DefaultErrorHandlerBuilder()
                .maximumRedeliveries(3)
                .redeliveryDelay(2000L));

            from("direct:start")
                .process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        System.out.println("PROCESSED");
                    }
                });
        }
    });
    context.addInterceptStrategy(new InterceptStrategy() {
        @Override
        public Processor wrapProcessorInInterceptors(CamelContext context, 
ProcessorDefinition<?> definition,
Processor target, Processor nextTarget) throws Exception {
            System.out.println("INTERCEPTOR");
            return new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    System.out.println("BEFORE");
                    target.process(exchange);
                    System.out.println("AFTER");

                }
            };
        }
    });
    context.start();
    ProducerTemplate template = context.createProducerTemplate();
    template.sendBody("direct:start", "foo");
}{code}
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to