camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Interceptor not working for manually created echanges
Date Sun, 10 Jan 2010 08:43:19 GMT
On Fri, Jan 8, 2010 at 4:31 PM, S. Ali Tokmen <savas-ali.tokmen@bull.net> wrote:
> Hello
>
> I'm currently using CAMEL 2.0.0 with a route that dynamically splits and
> routes a message to many destinations. I should be using a recipientList()
> but since the version 2.0.0 doesn't allow any exception handling I'm forced
> to using a construct like the following:
>
>    for (Map.Entry<String, Message> destination : destinations.entrySet()) {
>        Producer expediteur =
> exchange.getContext().getEndpoint(destination.getKey()).createProducer();
>        Exchange envoi = expediteur.createExchange();
>        envoi.setIn(destination.getValue());
>        expediteur.process(envoi);
>    }
>
> This actually works, and the outer processor gets an exception if any
> destination fails.
>
> Here's the issue: in my original context, I had a tracer defined like the
> following:
>
>    // Tracer, that will by default log on log4j and send to the
>    // fr.bull.cetebordeaux.traces JMS queue
>    Tracer tracer = new Tracer();
>    tracer.setFormatter(new CETEMessageFormatter());
>    tracer.setLogLevel(LoggingLevel.INFO);
>    tracer.setLogName("fr.bull.cetebordeaux.traces");
>    tracer.setDestinationUri("direct:traced");
>    this.from("direct:traced").process(new
> DefaultTraceEventMessageToStringProcessor()).to("registry:Trace.Queue");
>    this.getContext().addInterceptStrategy(tracer);
>
> That tracer is actually not active for the Exchange I've created "manually".
> Is this an expected behaviour?
>

The tracer works on the routes only. So it gets activated when any
Exchange gets routed to a Camel route.

So if you custom code send the Exchange to a "direct:foo" endpoint
which then has a route then it should get traced

from("direct:foo").to("bean:foo").to("bean:bar");

Then it should trace the routing direct:foo -> bean:foo -> bean:bar.
But NOT the manual code you did to send the Exchange to the direct:foo endpoint.





> Cheers
>
> --
>
> S. Ali Tokmen
> savas-ali.tokmen@bull.net
>
> Office: +33 4 76 29 76 19
> GSM:    +33 66 43 00 555
>
> Bull, Architect of an Open World TM
> http://www.bull.com
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message