jon lee
jon lee

Reputation: 887

Mule - Exception Strategy propagation across synch VM endpoints

I am experimenting with exception strategies and came across the following config.

If I invoke one flow from another using synchronous vm endpoints and do not catch exceptions in the callee flow. The caller flow exception strategy does not get invoked, but instead the callee flow adds an exceptionPayload.

I would assume if there is an exceptionPayload that the caller flow exceptions strategy would get invoked. But it doesn't. Is this a feature or a bug?

<flow name="main" doc:name="main">
        <poll frequency="60000">
            <set-payload value="main"></set-payload>
        </poll>

        <vm:outbound-endpoint address="vm://private" exchange-pattern="request-response" />
        <logger level="ERROR" message="After private #[exception]" />

        <catch-exception-strategy>
            <logger level="ERROR" message="Exception caught in parent." />
        </catch-exception-strategy>
    </flow>

    <flow name="private">
        <vm:inbound-endpoint address="vm://private" exchange-pattern="request-response" />
        <logger level="ERROR" message="private" />
        <null-component></null-component>
    </flow>

Also I can access the exceptionPayload via MEL using #[exception] but not via #[message.exceptionPayload]. Is there a reason why you cannot access it this way in Mule? I can see it on the DefaultMuleMessage.

Upvotes: 1

Views: 457

Answers (1)

David Dossot
David Dossot

Reputation: 33413

Mule is a message oriented platform therefore, by design, exceptions are contained within flows (not sub-flows) and get propagated as a specific message payload.

MEL works on context objects: here is the MessageContext object API where, as you see, there is no exceptionPayload field.

Upvotes: 2

Related Questions