I'm using Mule Studio and my flow has a transaction in it. If a file is not found, i'd like to exit the transaction without throwing an error. Mule Exception stack-traces are huge and ugly in logs.
Is there a way to just die <transaction-end> or something?
At this point I'd consider some form of tag to stop processing the message all together.
code to messy to give example but here's an excerpt:
<transactional action="ALWAYS_BEGIN" doc:name="Transactional">
<flow-ref name="ingest_provider" doc:name="Ingest Provider"/>
<flow-ref name="create_asset" doc:name="Create Asset"/>
<foreach collection="#[payload['Asset Resource']]" doc:name="Foreach Asset Resource">
<or-filter doc:name="Only movie or preview">
<expression-filter expression="#[payload['resource_class']=='movie']"/>
<expression-filter expression="#[payload['resource_class']=='preview']"/>
</or-filter>
<expression-transformer expression="payload.put('resource_guid', payload.guid); payload" doc:name="Expression"/>
<choice doc:name="Choice">
<when expression="#[!fileExists(new File('${ipvod.ingest.in.av}', payload.Content[0].filename).toString())]">
<logger message="Could not locate resource_file=#[new File('${ipvod.ingest.in.av}', payload.Content[0].filename).toString()] for asset_guid=#[flowVars.asset_guid]" level="ERROR" doc:name="Logger"/>
<set-payload value="#[asset_guid]" doc:name="Set Payload"/>
<!-- I'd like the code to die here -->
<scripting:component doc:name="Script">
<scripting:script engine="Groovy"><![CDATA[
throw new Exception('File Not Found!')
]]></scripting:script>
</scripting:component>
</when>
</choice>
I suggest to go with Mule Exception Strategy if you want to exit gracefully.
Here is a link of Mule's Exception Strategy Use Cases which has got some examples.
http://www.mulesoft.org/documentation-3.2/display/32X/Exception+Strategy+Most+Common+Use+Cases
Hope this helps.
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.