Sub-flows
don't have their own exception handling. Exceptions triggered in sub-flow are processed by calling flows(main flow)
Private flows
are another type of reusable flows, much similar to sub-flows but with a very different behavior in term of threading and exception handling. The primary reason for using a private flow instead of a sub-flow is to define in it a different exception strategy
than from the calling flow (something that is impossible with a sub-flow).
Private flow is nothing but the main flow without the inbound endpoint. To start the flow again, make your flow main-flow, with an inbound endpoint and in your catch exception strategy, create a java component implementing Callable interface and use muleClient.dispatch
to start flow again.
A sample component would be something like this:
import org.mule.api.MuleEventContext;
import org.mule.api.MuleMessage;
import org.mule.api.lifecycle.Callable;
import org.mule.api.client.MuleClient;
public class MyCustomComponent implements Callable {
@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
MuleClient muleClient = eventContext.getMuleContext().getClient();
muleClient.dispatch("jms://my.queue", "Message Payload", null);
}
}