On Fri, Mar 25, 2011 at 11:44 AM, Claus Ibsen <[email protected]> wrote: > On Fri, Mar 25, 2011 at 3:42 AM, Tim <[email protected]> wrote: >> so based on the cause of that bug, it is impossible to set the body of >> a jms message to null even if it was transformed earlier. >> So for example if you had: >> > > Its not a bug, thats how it was designed. > Its very unusual to route null messages. > > You should most likely be able to do a > exchange.setIn(new DefaultMessage()); > > Or something like that to work around your issue. >
I was a bit vague here when referring to not a bug, which was the CAMEL-3554 I was referring to. Indeed the JmsMessage would re-initialize the underlying JMS message if you set the message body to null. As it would think it wasn't initialized. So I have created a ticket to track that https://issues.apache.org/jira/browse/CAMEL-3805 > > > >> jmsmessage (a) -> bean which returns (b) based on that message -> bean >> c which returned null based on b -> bean d.. d would get (a) again. >> (note that it doesn't even get b which was after a). >> >> On Thu, Mar 24, 2011 at 9:38 PM, Tim <[email protected]> wrote: >>> I believe you ran into https://issues.apache.org/jira/browse/CAMEL-3354 >>> >>> On Thu, Mar 24, 2011 at 5:23 PM, Eric East <[email protected]> wrote: >>>> Thanks for response. >>>> >>>> I narrowed down my test case where I see the issue. >>>> >>>> When I initiate a route using a jms activeMQ broker (internal VM), the >>>> exchange.setBody(null) does not set the body to null. >>>> >>>> I am using Camel 2.5. Actvemq 5.4.1 >>>> >>>> >>>> TEST CASE FAILS: >>>> template.sendBody("activemqVM:topic:tlm", SomeObject); >>>> from("activemqVM:topic:tlm").to("direct:one") >>>> >>>> TEST CASE WORKS: >>>> template.sendBody("direct:one", SomeObject); >>>> >>>> >>>> ROUTE >>>> from("direct:one") >>>> .log("processing ${in.body}") >>>> .process(new Processor(){ >>>> public void process(Exchange exchange)throws Exception{ >>>> exchange.getIn().setBody(null); >>>> } >>>> }) >>>> .log("new body: [${in.body}]") >>>> .choice() >>>> .when().simple("${in.body} != null") >>>> .log(" != null") >>>> .otherwise() >>>> .log(" == null"); >>>> >>>> --Eric >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://camel.465427.n5.nabble.com/choice-when-check-BodyType-null-Body-null-tp4259599p4263203.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>> >> > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
