简体   繁体   中英

Mule: Setting session variable inside an invoke component

Best way to set a session variable inside an invoke component used to call a spring bean specific method.

<invoke object-ref="serviceBean" method="asyncFlowMethod" doc:name="Invoke3" methodArguments="#[sessionVars['event']]"/>


public void asyncFlowMethod(String event) {

        Inside this method i need to set a session variable 


    }

I would recomend you to change the method to receive the MuleMessage and use it to access the session variables:

public void asyncFlowMethod(MuleMessage message) {

        String event = message.getProperty("event", PropertyScope.SESSION);

        message.setProperty("event", event + "test", PropertyScope.SESSION);


    }

and invoke it using

<invoke object-ref="serviceBean" method="asyncFlowMethod" doc:name="Invoke3" methodArguments="#[message]"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM