Neron
Neron

Reputation: 1578

Set exchange body to null

I am trying to set null into the body of the exchange in xml definiton like this:

<camel:setBody>
    <camel:constant>null</camel:constant>
</camel:setBody>

or like this:

<camel:setBody>
    <camel:simple>null</camel:simple>
</camel:setBody>

they all give string "null" in the end.

Any idea about What the right form is?

Upvotes: 3

Views: 8741

Answers (4)

dey
dey

Reputation: 3140

In Camel 2.15.x I was doing this that way (and it worked):

<camel:setBody>
    <camel:simple resultType="java.lang.String">null</camel:simple>
</camel:setBody>

In recent versions of Camel it might be changed

Upvotes: 0

viBerlemont
viBerlemont

Reputation: 31

I'm working with Talend ESB (camel 2.17). I done it in javaDSL. This worked good to me :

.setBody().simple("${null}")

Upvotes: 3

stringy05
stringy05

Reputation: 7067

How about this?

<camel:setBody>
    <camel:simple>${bodyAs(null)}</camel:simple>
</camel:setBody>    

Upvotes: 0

Gnana Guru
Gnana Guru

Reputation: 715

Please try this

<camel:setBody>
    <camel:simple>${null}</camel:simple>
</camel:setBody>

Upvotes: 0

Related Questions