Hi,
I used something similar as your example to solve it. Works great! Thanks!
/Johan
Ashwin Karpe wrote:
>
> Hi Johan,
>
> You can do this in the following way
>
> from("somewhere")
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> String payload = exchange.getIn().getBody(String.class);
> // get URI from payload body and set it in header (optional if
> such a header exists)
> exchange.getIn.setHeader("targetURI",...)
> exchange.getIn().setBody("Changed body");
> }
> })
> .marshal(...) // Not sure what marshalling you need here
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception {
> String payload = exchange.getIn().getBody(String.class);
> String targetURI = exchange.getIn().getHeader("targetURI");
> ProducerTemplate producer = new ProducerTemplate(...);
> Exchange result = producer.send(targetURI , exchange);
> ...
> }
> }).
>
> Cheers,
>
> Ashwin...
>
>
> Johan Haleby wrote:
>>
>> I found out by myself. I simply put the uri in a header and simply pass
>> the header to the recipient list.
>>
>>
>> Johan Haleby wrote:
>>>
>>> Hi,
>>>
>>> I have a use-case where I must extract a endpoint uri from an object,
>>> marshal the object to an unknown format and then send the result to the
>>> extracted uri. Is there a built-in way to do this or do I have to
>>> manually persist the extract endpoint and retrieve a dynamic router or
>>> something? Here's some pseudo code describing what I'm looking for:
>>>
>>> from("somewhere").extractURIFromConsumedObject().
>>> marshal(encodeToUnknownFormat).to("uriThatWasExtractedFromTheConsumedObject");
>>>
>>> Thanks,
>>> /Johan
>>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/Store-data-be-used-in-other-steps-in-an-exchange-tp27159537p27166997.html
Sent from the Camel - Users mailing list archive at Nabble.com.