On Fri, Oct 23, 2009 at 6:35 PM, Paul Phillips <[email protected]> wrote:
>
> Hi there
>
> bit of a beginner question here.
>
> I have a situation where I want to
>
> - get some xml from a jms queue
> - send an id contained in the xml to a custom component i have written (the
> body of the request should be a string that looks like this: "ID=blah", so I
> use a bean to grab the id using xpath and change the body of the exchange)
> - this will return a message with a body that looks like "MATCHED=TRUE" or
> something
> - if MATCHED=TRUE then I want to send some xml to a different endpoint.
>
> However this final xml will be using stuff from the original xml that has
> been "discarded" on the way (? I am not even sure about this)
>
> What is the best way to go about getting this "old" data?
>
> hope it makes sense. I'm probably missing something really simple I know.
>
> A snippet from my route at the moment looks roughly like this:
>
> from("direct:deleteRoute").bean(Normalise.class,
> "getID").enrich("ioe:test:test1").choice().when(body().contains("MATCHED=TRUE").to("ioe:test3");
>
> where ioe uri's refer to my own custom component
>
> Hope all this makes sense!
>
Yeah the route example helps :)
Your custom component could store the answer as a header then you can
keep the original message along the way.
However you can also in fact the the original input message from the Camel API
Message original = exchange.getUnitOfWork().getOriginalMessage();
Object body = original.getBody();
But other people just store the payload as an Exchange property then
they can always grab it back later on demand
.setProperty("foo", body())
.// do something else
// and now restore the body back
.setBody(property("foo"))
> Thanks
> Paul.
>
>
> --
> View this message in context:
> http://www.nabble.com/beginner-question-tp26029591p26029591.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus