camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Camel Guy <ca...@devguy.com>
Subject Re: Best way to discard changes made to Exchange by invoked route
Date Tue, 11 Nov 2014 18:23:31 GMT
Hi Claus,

Indeed, after running a test program, I confirmed that enrich and
recipientList 'hide' changes made to properties but not to headers.
This is not the case, however, for dynamicRouter, which doesn't hide
changes made to headers or properties.

split works for headers in addition to properties -- I imagine that
seda does as well.

Is enrich more efficient than split? Wondering if it's worth changing
the code to use properties.


Thanks!
cg

On Tue, Nov 11, 2014 at 9:30 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> You can store information as exchange properties and they stick around
>
> On Tue, Nov 11, 2014 at 6:00 PM, Camel Guy <camel@devguy.com> wrote:
>> Hi Claus,
>>
>> Thank you again for your reply. Unfortunately I did not see anything
>> in that FAQ that relates to my problem.
>>
>> From route A, I am invoking route B (serially) that deletes a header
>> key. I would like the header key to exist for route A afterwards even
>> though route B deleted it. Using a splitter works great. I can not get
>> enrich or recipientList to work.
>>
>> This is a contrived example. The general use case is invoking routes
>> without side-effects so they can be called recursively -- as
>> subroutines.
>>
>>
>> Thanks,
>>
>> cg
>>
>> On Tue, Nov 11, 2014 at 12:00 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>>> See this FAQ
>>> http://camel.apache.org/why-is-my-message-body-empty.html
>>>
>>> On Tue, Nov 11, 2014 at 8:22 AM, Camel Guy <camel@devguy.com> wrote:
>>>> Hi Claus,
>>>>
>>>> Thanks for the pointer!
>>>>
>>>> This program logs "INFO hello" followed by an empty INFO message. I
>>>> would like the second logged message to also be "INFO hello."
>>>>
>>>> Am I doing something wrong?
>>>>
>>>> Camel 2.14.0
>>>>
>>>>
>>>> Thank you,
>>>> ~cg
>>>>
>>>> <route>
>>>>   <from uri="direct:Test"/>
>>>>   <setHeader headerName='bar'><constant>hello</constant></setHeader>
>>>>   <log message="${header.bar}"/>
>>>>   <enrich uri="direct:Foo"/>
>>>>   <log message="${header.bar}"/>
>>>> </route>
>>>>
>>>> <route>
>>>>   <from uri="direct:Foo"/>
>>>>   <removeHeader headerName='bar'/>
>>>> </route>
>>>>
>>>> On Mon, Nov 10, 2014 at 10:06 PM, Claus Ibsen <claus.ibsen@gmail.com>
wrote:
>>>>> See about the content enricher
>>>>>
>>>>> On Tue, Nov 11, 2014 at 4:21 AM, Camel Guy <camel@devguy.com> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I am using Spring XML. I would like to invoke a route synchronously,
>>>>>> passing the current Exchange. However, I want to discard the changes
>>>>>> that the invoked route makes to the Exchange (e.g., modification
of
>>>>>> headers).
>>>>>>
>>>>>> So far this is the shortest recipe that results in the desired behavior:
>>>>>>
>>>>>> <split><constant>1</constant><to uri="direct:Foo"/></split>
>>>>>>
>>>>>> Is there a more elegant way to do this?
>>>>>>
>>>>>> I tried <recipientList><constant>direct:Foo</constant></recipientList>
>>>>>> but the current Exchange was modified.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> ~cg
>>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> Red Hat, Inc.
>>> Email: cibsen@redhat.com
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.com
>>> Author of Camel in Action: http://www.manning.com/ibsen
>>> hawtio: http://hawt.io/
>>> fabric8: http://fabric8.io/
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/

Mime
View raw message