The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

OrBee (61) [Avatar] Offline
#1
On the question of scopes, I read the book section on scopes. I would like to clarify and confirm my understanding of session scope. In my flow the transformed payload gets lost as a result of an exception whenever an external service is unavailable. I therefore save the payload in a session scoped variable to preserve it between flows.

The incoming endpoint of the main flow is a jms inbound endpoint.

Here's my question on Session scope:

Does the session scope differ within flows for each incoming message, since the book says "Think ThreadLocal...." For example if I get incoming message1, will it have retain its own session scoped payload that will not interfere or be overwritten with the session scoped payload of incoming message2 from the jms queue? My processing-strategy is synchronous
David Dossot (233) [Avatar] Offline
#2
Re: Mule Session Scope
The full sentence in the book is: "think of Java’s ThreadLocal mechanism but with a MessageLocal twist".

What we were trying to say is that the session properties are bound to the message and can be carried with it through multiple endpoints / flows.

So in your case, the answer is no: when message2 comes into the flow, it will not have any of the session properties of message1.
OrBee (61) [Avatar] Offline
#3
Re: Mule Session Scope
Thank you, that's the behaviour I wanted to confirm, that the session variables are per inbound message in the flows