Java – mule: get exception message

I have a default catch exception in mule. I'm trying to access the exception message using mule expression: # [exception]

This doesn't seem to work. I guess I'm trying to access the wrong variable? I'm trying to log it using logger and run a custom component (as a string) that receives exception messages

thank you,

Solution

You can do this #[exception. Causedby]

<choice-exception-strategy>
        <catch-exception-strategy when="exception.causedBy(com.company.BusinessException)"> <!-- [1] -->
            <jms:outbound-endpoint queue="dead.letter">
                <jms:transaction action="ALWAYS_JOIN" />
            </jms:outbound-endpoint>
        </catch-exception-strategy>
        <rollback-exception-strategy when="exception.causedBy(com.company.NonBusinessException)"> <!-- [2] -->
            <logger level="ERROR" message="Payload failing: #[payload]"/>
        </rollback-exception-strategy>
    </choice-exception-strategy>

More details here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>