I'd like to send a JMS message at the beginning and end of processing a REST request. I can do something like this:
<set-variable variableName="savedPayload" value="#[payload]" doc:name="Variable" />
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<scripting:text><![CDATA[
'{"event" : "TRY"}'
]]></scripting:text>
</scripting:script>
</scripting:component>
<jms:outbound-endpoint queue="event.detail" connector-ref="jmsConnector" />
<expression-transformer evaluator="groovy" expression="savedPayload" />
Essentially, the JMS would just be used to record the entry and exit (SUCCESS or FAILED) while preserving the saved message, which the code above does using a variable. What's a shorter, idiomatic way of doing this in a Mule flow?
Edit:
To put this another way, is there a way to send that outbound message with a payload without the save/restore needed to hang on to the response payload?