Mule 4 architecture with events, flows, and configuration
A Mule application processes events. An event carries the message with payload and attributes as well as variables and passes through the components of a flow. We structure larger applications into several flows and subflows that call each other through Flow Reference. Connection details and other shared settings live in global elements that all flows reference.
On Error Continue or On Error Propagate
Mule 4 assigns every error a type, such as HTTP:NOT_FOUND or DB:CONNECTIVITY, and the error handler selects the first matching handling. On Error Propagate executes its steps and passes the error on to the calling level, and a transaction owned by the flow is rolled back. On Error Continue executes its steps and ends the flow as if it had completed successfully, and the transaction is committed. Which variant fits depends on whether the caller needs to learn about the error.
Flows organize an application by tasks, error types organize what can go wrong along the way.
The levels of error handling in Mule 4
The runtime offers several levels. A global error handler applies to the entire application. Every flow can bring its own error handling, and a subflow uses that of the calling flow. The Try scope encloses individual steps and handles their errors on the spot. For transient faults, the Until Successful scope repeats a step up to a defined number of attempts, and connectors re-establish a dropped connection through their reconnection strategy. We combine these means per integration.
For an industrial company, we built an integration layer on CloudHub 2.0 that brings business credit data from D&B Direct+ into the SAP process in real time. The flows are designed to be resilient, so that a failed query does not block the SAP process if the external service does not respond at some point.