Jaco Fourie
Jaco Fourie

Reputation: 162

Using Mule variables or properties accross transport barriers

Let say I get a inbound variable from an http connector when I use this URL

http://x.x.x.x:8080/post?post-message=Hallo wold.

How can I use the value of the #[header:INBOUND:post-message] accross the complete flow from after the HTTP connector all the way up tp the end. Should I use the Mule Object store to write it to ram?

This post shows the scope of variables but it seem there is not one thay can flow from start to en like a session bean

https://m-square.com.au/mule-school-the-mulemessage-property-scopes-and-variables/

Kind Regards.

Upvotes: 0

Views: 1771

Answers (3)

Soumya
Soumya

Reputation: 59

There are three type of scope level variables supported by mule . You can use flow variable if you want the variable to be accessible throughout the whole flow. You can use session variable if you want it to be accessible form other flows through a transport barrier.

Refer this blog for getting better understanding of how different types of variables are propagated between different mule flows.

http://blogs.mulesoft.com/dev/anypoint-platform-dev/mule-school-the-mulemessage-property-scopes-and-variables/

Upvotes: 0

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8311

Mule Session variables are good enough to get the value throughout application.
But if you need to use the value outside your application, then you can set mule outbound properties.

Upvotes: 0

Seba
Seba

Reputation: 2319

  • If you need the variable available throughout the whole flow (and other flows reached through a flow-ref) use the invocation scope (set-variable to set, flowVars[] to read it)

  • If you need it to reach other flows through a transport (e.g. VM) put it in the outbound or session scope.

  • If you need it to live as long as the app is running, through different calls, use the Mule registry (volatile, only available as long as the app is up) or the object store (which can be configured as persistent, to hold state even if the app goes down).

Upvotes: 5

Related Questions