Reading Time: 3 minutes

Do you want share properties between instances? or just between different flows within Mule?. Then mule session properties are what you are looking for.

How to add session properties

The easier way is through Mule MessagePropertyTransformer:

latest report
Learn why we are the Leaders in management and

You can also accede Mule session using MuleEventContext:

Considerations using Mule session properties

  • Mule session is transmitted with each external call so don't store stuff that you don't need to avoid draining i/o performance
  • Mule session is maintained while the Message is going through mule instances so don't store stuff you don't need to avoid wasting memory
  • Only java.io.Serializable objects will be transmitted between two flows
  • Currently if you add a non Serializable session property you will lose it after calling another flow. Since Mule 3.1.3 there's a new merging strategy for session properties that will avoid losing them
  • When using http endpoints Mule session is stored as a custom http header so there are some limitations in header size. HTTP specification does not limit length of headers at all. However web-servers do limit header size they accept, throwing “413 Entity Too Large” if it exceeds or you can also get a java.io.SocketException: Broken Pipe in the client side
  • If you call an outbound endpoint with message exchange pattern one way, then the called flow will be able to access session properties, but modifications to session properties inside that flow will not be reflected in the caller flow
  • Don't stick with Mule session scope every time. Try to use the best Mule property scope that suits your requirements