Hi

You need to add the interceptors to the RoutesDefinition

On Tue, Jun 12, 2012 at 11:33 AM, fradj zayen <zaye...@gmail.com> wrote:

> Hi all,
> I'd like to add interceptors to camel context programatically. below some
> code snippet
>
> Camel Context definition:
>
> CamelContext camelContext=new DefaultCamelContext();
>      RouteDefinition routeDefinition=new RouteDefinition();
>      routeDefinition.from("direct:a").to("direct:b").to("direct:c");
>      camelContext.getRouteDefinitions().add(routeDefinition);
>      camelContext.setTracing(true);
>      camelContext.start();
>
>
> Interceptor to be used:
>
> InterceptSendToEndpointDefinition interceptor=new
> InterceptSendToEndpointDefinition( "direct:b");
>        interceptor.process(new Processor()
>      {
>
>         public void process(Exchange exchange) throws Exception
>         {
>           System.out.println(exchange);
>
>         }
>      });
>        interceptor.to("log:intercepted ${body}");
>
>        interceptor.end();
>
> I used the following configuration to add the interceptor to the camel
> context, but the interceptor is not fired when an exchange is sent to the
> intercepted endpoint
> ((ModelCamelContext)
> camelContext).getRouteDefinitions()..get(0).getOutputs().add( interceptor);
>
>
> Can someone help on this?
> thanks for your help
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to