Hi,

I have a webservice internally calling a couple of other subordinate 
webservices. I'm trying to upgrade it to an async non-blocking way using Camel. 
So far it's route looks like this:

        <camel:route>
            <camel:from uri="direct:anAsyncNioService" />
            <camel:bean ref="processor1" />
            <camel:multicast stopOnException="true" parallelProcessing="true">
                <camel:bean ref="processor21" />
                <camel:bean ref="processor22" />
            </camel:multicast>
            <camel:bean ref="processor3" />
        </camel:route>

But I'm stuck with a couple of unsolved issues:
  1. Originaly service parts (which are now processor1, *21, *22 and *3) used a 
request-scoped Spring bean holding context. Spring stores it in a ThreadLocal 
object so it causes issues both when a new thread is involved in <multicast> 
and when a callback is invoked in a randomly-associated thread on a responce 
coming from a subordinate service called.
  2. Original service uses slf4j (logback) for loggig and maintains an MDC 
(http://logback.qos.ch/manual/mdc.html). The MDC is again inside 
LogbackMDCAdapter stored in a ThreadLocal. Hence same issue as with 
request-scoped beans.

I do understand that in Camel all request-scoped info should be stored inside 
the Exchange. But as I pointed above it conflicts with lots of so convenient 
third-party things as request-scoped Spring beans and MDC are. So I wonder how 
do others solve it?


 ---
 Best regards


Reply via email to