camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owain <ow...@integration.technology>
Subject Re: Restoring body from header holding MyPojo works differently in test (with mock) than production
Date Tue, 30 May 2017 07:43:15 GMT
Thanks Claus.

So the general rule appears to be  that do not rely on the class of headers
as the components may manipulate them.  So it looks as though MockEndpoint
leaves them alone whereas the enrich route changes the type from pojo to
string.

Quoting from the book:  

"Properties—Similar to message headers, but they last for the duration of
the entire exchange. Properties are used to contain global-level
information, whereas message headers are specific to a particular message.
Camel itself will add various properties to the exchange during routing.
You, as a developer, can store and retrieve properties at any point during
the lifetime of an exchange."

So a simple change to the route to this works a treat.

                  .setProperty("savemybody").body()
                  .inOut("direct:doSomething")
                  .setProperty("returnedBody").body()
                  .setBody().simple("${property.savemybody}")

O.




--
View this message in context: http://camel.465427.n5.nabble.com/Restoring-body-from-header-holding-MyPojo-works-differently-in-test-with-mock-than-production-tp5800667p5801330.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message