On Wed, Mar 27, 2013 at 10:02 PM, Christian Müller <[email protected]> wrote: > Isn't it called in a separate thread, isn't it? >
Ah yeah, then use this as base class http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/support/SynchronizationAdapter.html And return false from the allowHandover method Then its done on the same thread. > Sent from a mobile device > Am 27.03.2013 08:14 schrieb "Claus Ibsen" <[email protected]>: > >> You can use this method on the Exchange >> >> >> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Exchange.html#addOnCompletion(org.apache.camel.spi.Synchronization) >> >> >> On Tue, Mar 26, 2013 at 2:13 PM, davelund <[email protected]> wrote: >> > We are currently using ThreadLocal to store some information that gets >> > included in a log4j converter (and is used in other projects that dont >> have >> > camel in). Is there a callback I can use that for all routes in my >> context >> > so that at the end of the route it will get called (without explicitly >> > setting it) For example: >> > from("jms:somequeue") >> > .processRef("someRandomProcessor") >> > .processRef("someProcessorThatSetsThreadLocalValue") >> > .... >> > .to("jms:someotherqueue") >> > >> > >> > Ideally I'd like the threadlocal cleared when the exchange has been >> written >> > to the queue, without adding a processor that explicitly clears it (as >> > developers when adding new routes will forget to do it). I know the >> > onCompletion runs in a seperate thread so isn't fit for my purpose. I've >> > noticed syncronisations and unitofworks, but cant seem to find any >> > documentation on it. Would this be fit for purpose? >> > >> > >> > >> > -- >> > View this message in context: >> http://camel.465427.n5.nabble.com/Clearing-ThreadLocal-when-exchange-completes-tp5729849.html >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> Red Hat, Inc. >> FuseSource is now part of Red Hat >> Email: [email protected] >> Web: http://fusesource.com >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
