1

According to the following ticket: https://www.mulesoft.org/jira/browse/MULE-6427 For NullPayload I should be able to use :

<when expression="#[payload == null]">

but that doesn't work. It fails. I am using Mule 3.5.1

Here is an example flow:

<flow name="testNull">
        <poll frequency="10000">
            <logger />
        </poll>

        <set-payload value="#[org.mule.transport.NullPayload.getInstance()]" />

        <choice>
            <when expression="#[payload == null]">
                <logger level="ERROR" message="NullPayload is same as null" />
            </when>
            <otherwise>
                <logger level="ERROR" message="Doesnt work" />
            </otherwise>
        </choice>

    </flow>

This will always print 'Doesn't work'. However message.payload == null works. Whats the difference between "payload" and "message.payload"?

jon lee
  • 887
  • 1
  • 15
  • 32

1 Answers1

1

There seems to be an issue with the #[payload] alias. Use the real thing and it will work: #[message.payload].

Víctor Romero
  • 5,107
  • 2
  • 22
  • 32
  • 1
    Also I created the following issue to track the problem: https://www.mulesoft.org/jira/browse/MULE-8217 – Víctor Romero Jan 09 '15 at 14:43
  • 2
    noticed this before also. "payload" never goes through the MessageContext where the null conversion happens. Did a quick fix locally. Will commit and raise a pr. – Ryan Carter Jan 09 '15 at 18:09