I have a "Catch Exception Strategy" in my flow and I use the SMTP connector to send an email to the admin (me).
I am able to send the exception using #[exception]
but I would like to send a more detailed message including :
I tried to use an Expression component and Variables to store those information. I also tried with the variable component but that didn't work either. All my variables are always set to null in the message.
Here's my flow :
<flow name="PivotalContactById" >
<https:inbound-endpoint connector-ref="HTTP_HTTPS" exchange-pattern="request-response" host="host" port="port" doc:name="HTTP (Deprecated)" path="path"/>
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
<set-variable variableName="flowVars.url" value="#[message.inboundProperties.'http.context.url']" doc:name="Variable"/>
<set-variable variableName="flowVars.originalPayload" value="#[payload]" doc:name="Variable"/>
<json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
<scripting:component doc:name="GroovyContactIDJsonToXML">
<scripting:script engine="Groovy" file="pivotalContactById_JSON_to_XML.groovy"></scripting:script>
</scripting:component>
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
<set-variable variableName="flowVars.convertedPayload" value="#[payload]" doc:name="Variable"/>
<ws:consumer config-ref="Web_Service_Consumer1" operation="GetContactById" doc:name="Pivotal SOAP Web Service"/>
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
<catch-exception-strategy doc:name="Catch Exception Strategy">
<set-payload value="#[exception] #[flowVars.url] #[flowVars.originalPayload] #[flowVars.convertedPayload]" doc:name="Set Payload"/>
<smtp:outbound-endpoint host="host" to="dude@dude.org" from="adminmule@dude.org" subject="Exception yo" responseTimeout="10000" doc:name="SMTP"/>
</catch-exception-strategy>
</flow>
In flow Level, please provide the variableName = url alone(Not as flowVars.url). When accessing it in Catch Exception Strategy set as #[flowVars.url]
or #[flowVars['url']]
.