Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mule MEL check for NullPayload vs null

Tags:

mule

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 fails. So instead I have to use:

<when expression="#[payload is NullPayload]">

Am I doing something wrong? Or is this the correct way for checking for null or NullPayload?

like image 592
jon lee Avatar asked Dec 05 '14 12:12

jon lee


1 Answers

In theory, this should be fixed, but it doesn't looks like so. I'm using CE 3.4.0 and the expression #[payload == null] doesn't work for NullPayload.

I've found this link that shows how to check if payload is NullPayload correctly:

#[payload is org.mule.transport.NullPayload]

I actually needed to know if payload was not NullPayload, so my expression was:

#[!(payload is org.mule.transport.NullPayload)]

Works like a charm. :)

like image 114
mathielo Avatar answered Sep 20 '22 16:09

mathielo