Hi

Maybe its related to this FAQ:
http://camel.apache.org/why-is-my-message-body-empty.html

On Tue, Jul 28, 2015 at 8:44 PM, Dan Moore <[email protected]> wrote:
> Hi folks,
>
> I have an object coming in to the exchange from a direct route.
>
>         from("direct:test2")
> //            .log("plain message")
> //            .log(LoggingLevel.INFO, log, "this is a test 2" )
>             .setProperty("origMsg", body()) // Store the Original Message
>             .log(LoggingLevel.INFO, log, "body saved off:
> ${exchangeProperty.origMsg}" )
>             .end();
>
> If either of the first two log statements are uncommented, then the final
> log statement succeeds--the origMsg is placed on the exchange in a property
> (it's a serializable pojo, if that matters).
>
> However, if the first two log statements are commented out, as above, then
> the output looks like:
>
> 12:35:27.246 [qtp173207982-22] INFO  MyRoute [CamelLogger.java:176] - body
> saved off:
>
> That is, the body is blank.
>
> If I place a delay() between the from() and setProperty(), that also fails:
>
>         from("direct:test2")
>             .delay(1000)
>             .setProperty("origMsg", body()) // Store the Original Message
>             .log(LoggingLevel.INFO, log, "body saved off:
> ${exchangeProperty.origMsg}" )
>             .end();
>
> I am using java8/camel 2.15.2, and have confirmed the behavior on windows
> and macos.
>
> It seems to me that log() returns 'this', that is the ProcessorDefinition,
> while from() returns a subclass of ProcessorDefinition, and that might be
> causing setProperty() to be set on a different object.  But that is pure
> speculation.
>
> Am I using setProperty incorrectly?  What am I missing?
>
> Thanks,
> Dan



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Reply via email to