Mule - how do you clear the payload/set the payload to null?

12,889

Try setting it explicitly to null:

<set-payload value="#[null]" doc:name="Set Payload"/>
Share:
12,889
danw
Author by

danw

Updated on July 26, 2022

Comments

  • danw
    danw over 1 year

    How do I clear the payload/set it to null in Mule? I've been using:

    <set-payload value="" doc:name="Set Payload"/>
    

    This works fine until I add an element to my flow using the GUI in Mule Studio, then the element changes to the following, which throws errors:

    <set-payload  doc:name="Set Payload"/>
    

    Thanks in advance.

  • granthbr
    granthbr over 7 years
    This suggestion caused a null pointer exception for me. It is easier to just use a message enricher and return the payload opposed to this option.
  • Dale
    Dale over 3 years
    null is different than empty. This is not the best approach