Wednesday, July 13, 2011

MULE - Logging Catch All Strategy

Mule Version: 2.2.X

This catch-all strategy simply logs a warning indicating that the message was not dispatched because there was no routing path defined.

        <service name="StdioService">
            <inbound>
                <stdio:inbound-endpoint system="IN"
                    connector-ref="stdioInConnector" />
            </inbound>
            <outbound>
                <pass-through-router>
                    <vm:outbound-endpoint path="processInputIN" />
                </pass-through-router>
            </outbound>
        </service>


        <service name="ProcessInput">
            <inbound>
                <vm:inbound-endpoint path="processInputIN" />
            </inbound>
            <component class="org.mybusiness.components.ProcessInputComponent" />
            <outbound>
                <filtering-router>
                    <vm:outbound-endpoint path="computeLengthIN" />
                    <payload-type-filter
                        expectedType="java.lang.String" />
                </filtering-router>
                <logging-catch-all-strategy />
            </outbound>
        </service>


        <service name="ComputeLength">
            <inbound>
                <vm:inbound-endpoint path="computeLengthIN" />
            </inbound>
            <component
                class="org.mybusiness.components.ComputeLengthComponent" />
        </service>

Sample Output:

2011-07-13 12:16:09 DefaultMuleEvent [WARN] Message: org.mule.transport.DefaultMessageAdapter/org.mule.transport.DefaultMessageAdapter@1381960{id=cd064835-ad73-11e0-a7ab-f54458c9dc0c, payload=java.lang.Exception, properties=Properties{invocation:{}, inbound:{}, outbound:{MULE_ENCODING=UTF-8, MULE_CORRELATION_ID=cd064835-ad73-11e0-a7ab-f54458c9dc0c, MULE_ENDPOINT=vm://processInputIN, MULE_ORIGINATING_ENDPOINT=endpoint.vm.processInputIN}, session:{}, }, correlationId=cd064835-ad73-11e0-a7ab-f54458c9dc0c, correlationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null} was not dispatched on session: org.mule.DefaultMuleSession@9fa8f. No routing path was defined for it.

No comments:

Post a Comment