Thiru
Thiru

Reputation: 424

How to increment session variable in mule ESB?

I have a requirement like first two messages need to be routed into one direction next three into another direction after some other root. I came to know that session variable scope and lifetime will be throughout the session. so i tried like

[sessionVars.count+1]

but getting concatenated value instead addition. initial count value is 0 and i'm running on mule 3.8.2.

Upvotes: 1

Views: 1880

Answers (1)

Simon Karlsson
Simon Karlsson

Reputation: 4129

First initialize your session variable

<set-session-variable variableName="count" value="#[0]"/>

To increment it

<set-session-variable variableName="count" value="#[sessionVars.count + 1]"/>

Upvotes: 2

Related Questions