How to catch exceptions in the Mule foreach scope but keep the process going?

眉间皱痕 提交于 2019-12-05 16:18:26

Use a private flow for the content of the for-each with its own exception strategy. THe exception will be handled in the private flow and the parent flow should be able to continue. Something like:

<flow name="ProcessOrderStastusUpdate">
   <foreach collection="#[payload]" doc:name="For Each">
      <flow-ref name="privateFlow" />    
   </foreach>
</flow>

<flow name="privateFlow">
   <component doc:name="Set Magento Order Status for Update">
      <singleton-object class="com.dse.esb.component.OrderStatusMapperComp">
             <property key="as400OrderStatuses" value="${as400.orderstatuses}"/>
             <property key="magentoOrderStatuses" value="${magento.orderStatuses}"/>
      </singleton-object>
   </component>
   <logger message="About to update Magento Order Status" level="INFO" doc:name="Logger"/>
   <magento:add-order-comment config-ref="Magento" comment="Updated by Mule ESB with AS400 order status: #[payload.TRNSTS]" orderId="#[payload.EPGORDNBR]" status="#[flowVars['magentoOrderStatus']]" doc:name="Update Magento Order Status"/>


    <choice-exception-strategy doc:name="Choice Exception Strategy">
        <catch-exception-strategy doc:name="default">
            <logger message="Handle default exception" level="INFO" category="==============&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" doc:name="Logger"/>
        </catch-exception-strategy>
    </choice-exception-strategy>
</flow>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!