I am new to Mule ESB. I created a simple thread that iterates over a list of orders and calls the Magento API to update order statuses one by one. My problem is that if there are any exceptions in the foreach area, the whole process ends. I tried to use the Exception Strategy to catch the exception, and that fixed the exception. But how to resume the process? I did not find much information about googling. Maybe I was doing something wrong with the thread. How do we usually deal with this in Mule?
Here is my stream in xml.
<flow name="Update_Magento_Order_Status_AU" doc:name="Update_Magento_Order_Status_AU" initialState="started">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="10" timeUnit="MINUTES"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="GET_ORDERS_BY_STATUS_QUERY" queryTimeout="-1" connector-ref="DSEDatabase" doc:name="Get Orders By Status"/>
</poll>
<flow-ref name="ProcessOrderStastusUpdate" doc:name="Process Order Status Update"/>
</flow>
<flow name="ProcessOrderStastusUpdate" doc:name="ProcessOrderStastusUpdate">
<foreach collection="#[payload]" doc:name="For Each">
<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"/>
</foreach>
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="default">
<logger message="Handle default exception" level="INFO" category="==============>>>>>>>>>>>>" doc:name="Logger"/>
</catch-exception-strategy>
</choice-exception-strategy>
</flow>
source
share