Oleg,
That's correct. The message carries a header containing a unique piece of data which can be used to determine the destination thread.
Oleg,
That's correct. The message carries a header containing a unique piece of data which can be used to determine the destination thread.
Thanks, and the other question is are you storing something in thread local? I mean can the same thread be shared by more then one Messages, as long as its the same thread?
Oleg Zhurakousky
Spring Integration team
http://twitter.com/z_oleg
http://blog.springsource.com/author/ozhurakousky/
The only thing I store is an InheritableThreadLocal which contains the same value for all Messages which are processed by the same thread.
An example. Suppose we have incoming messages on different working threads. On the worker thread, I create a threadlocal containing the value for the 'destination' header ( I do this because we apply a security check on these threads, and the security setup is related to the 'destination'.)
All messages on the worker threads are then routed to their single 'dedicated thread', the threadlocal variable is passed to that dedicated thread, but because the routing mechanism only routes threads with the same 'destination' to the dedicated thread, it actually stays the same. But in short: yes, I am storing something in an (inheritable)threadlocal, but this value is always the same and can't and may not be altered.
Message Message headers Incoming thread Dedicated thread MSG-1 destination=dedicatedThread1,.. Worker thread 3 dedicatedThread1 MSG-2 destination=dedicatedThread2,.. Worker thread 5 dedicatedThread2 MSG-3 destination=dedicatedThread1,.. Worker thread 9 dedicatedThread1
I don't use scoped-proxy. We (ab)use the "invalid scope" for some integration tests, but not in production code.