You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by atg roxx <at...@gmail.com> on 2012/03/22 12:50:01 UTC
How to get header parameter in a to route of camel
Hi All,
I am doing some processing in a route before sending it to next end point.
and in that processor I am setting some header parameter which I want to
use to form the next route URL.
from( "jms:request")
.process(new AddHeader())
.to("cxfrs://http://abc.com/" + < header (test)>)
AddHeader implements Processor{
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("test", "test");
exchange.getOut().setBody( exchange.getIn().getBody(), String.class);
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
}
}
Is it possible to have the header value test which is set in the AddHeader
to be available in the to() route.
Or is there any other way out to get that test in the to() route.
--Regards,
atg roxx
Re: How to get header parameter in a to route of camel
Posted by atg roxx <at...@gmail.com>.
Hi RNPG,
I check the links you have provided and they are really good, but they dont
seem to solve my problem.
I want to genreatet the URI in dynamic fashion. i.e http://abc.zyz.com/<this
part has to be is dynamically added whose value is there in one of the
header parameter >
Can you suggest a way how to generate this uri.
--Regards,
atg roxx
On Thu, Mar 22, 2012 at 12:22 PM, Reuben Garrett <re...@gmail.com>wrote:
> atg,
>
> your use case reminds me of the Dynamic Router and Recipient List EIPs:
>
> http://camel.apache.org/dynamic-router.html
> http://camel.apache.org/recipient-list.html
> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>
> is this helpful?
>
> ~ RNPG
>
>
> On Thursday, March 22, 2012, atg roxx <at...@gmail.com> wrote:
> > I am doing some processing in a route before sending it to next end
> point.
> > and in that processor I am setting some header parameter which I want to
> > use to form the next route URL.
>
How to get header parameter in a to route of camel
Posted by Reuben Garrett <re...@gmail.com>.
atg,
your use case reminds me of the Dynamic Router and Recipient List EIPs:
http://camel.apache.org/dynamic-router.html
http://camel.apache.org/recipient-list.html
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
is this helpful?
~ RNPG
On Thursday, March 22, 2012, atg roxx <at...@gmail.com> wrote:
> I am doing some processing in a route before sending it to next end point.
> and in that processor I am setting some header parameter which I want to
> use to form the next route URL.
Re: How to get header parameter in a to route of camel
Posted by Christian Müller <ch...@gmail.com>.
I didn't used the cxfrs component until now, but my expectation would be:
- set the header you would like to send as message header
- may provide your own "headerFilterStrategy" (checkout [1] for this)
This should work, IMO. If not, feel free to raise a JIRA for it.
[1] http://camel.apache.org/cxf.html
Best,
Christian
On Thu, Mar 22, 2012 at 12:50 PM, atg roxx <at...@gmail.com> wrote:
> Hi All,
>
> I am doing some processing in a route before sending it to next end point.
> and in that processor I am setting some header parameter which I want to
> use to form the next route URL.
>
>
> from( "jms:request")
> .process(new AddHeader())
> .to("cxfrs://http://abc.com/" + < header (test)>)
>
>
>
> AddHeader implements Processor{
>
> @Override
> public void process(Exchange exchange) throws Exception {
>
> exchange.getIn().setHeader("test", "test");
> exchange.getOut().setBody( exchange.getIn().getBody(), String.class);
> exchange.getOut().setHeaders(exchange.getIn().getHeaders());
>
> }
>
> }
>
> Is it possible to have the header value test which is set in the AddHeader
> to be available in the to() route.
>
> Or is there any other way out to get that test in the to() route.
>
>
> --Regards,
> atg roxx
>
Re: How to get header parameter in a to route of camel
Posted by atg roxx <at...@gmail.com>.
Hi Marco,
I am facing a strange problem when using recipientList, the processor
method where I am setting the value in header is getting the input as the
appended value of the earlier request.
from( "jms:request")
.process(new AddHeader("test"))
.to("cxfrs://http://abc.com/" +< header (test)>)
Could you please explain this or is it bug ?
-Regards,
atg roxx
On Thu, Mar 22, 2012 at 3:36 PM, Marco Westermann <Ma...@gmx.de>wrote:
> Hi,
>
> you cannot use simple language in the to endpoint-uri, but you can use it
> in the recipientList
> from( "jms:request")
> .process(new AddHeader())
> .recipientList(simple("cxfrs:/**/http://abc.com/${header.test}**
> "));
>
> regards,
>
> Marco
>
>
>
> Am 22.03.2012 16:13, schrieb atg roxx:
>
> Hi Alex,
>>
>> I doubt that we can use simple within to. I am getting compilation error
>> for it.
>>
>> Regards,
>> -atg roxx
>>
>> On Thu, Mar 22, 2012 at 2:59 PM, Alex Anderson<alex@frontlinesms.com**
>> >wrote:
>>
>> from( "jms:request")
>>>> .process(new AddHeader())
>>>> .to("cxfrs://http://abc.com/" +< header (test)>)
>>>>
>>> Have you tried:
>>>
>>> .to(simple("cxfrs://http://**abc.com/${header.test}<http://abc.com/$%7Bheader.test%7D>
>>> "))
>>>
>>>
>
Re: How to get header parameter in a to route of camel
Posted by Marco Westermann <Ma...@gmx.de>.
Hi,
you cannot use simple language in the to endpoint-uri, but you can use
it in the recipientList!
from( "jms:request")
.process(new AddHeader())
.recipientList(simple("cxfrs://http://abc.com/${header.test}"));
regards,
Marco
Am 22.03.2012 16:13, schrieb atg roxx:
> Hi Alex,
>
> I doubt that we can use simple within to. I am getting compilation error
> for it.
>
> Regards,
> -atg roxx
>
> On Thu, Mar 22, 2012 at 2:59 PM, Alex Anderson<al...@frontlinesms.com>wrote:
>
>>> from( "jms:request")
>>> .process(new AddHeader())
>>> .to("cxfrs://http://abc.com/" +< header (test)>)
>> Have you tried:
>>
>> .to(simple("cxfrs://http://abc.com/${header.test}"))
>>
Re: How to get header parameter in a to route of camel
Posted by atg roxx <at...@gmail.com>.
Hi Alex,
I doubt that we can use simple within to. I am getting compilation error
for it.
Regards,
-atg roxx
On Thu, Mar 22, 2012 at 2:59 PM, Alex Anderson <al...@frontlinesms.com>wrote:
> > from( "jms:request")
> > .process(new AddHeader())
> > .to("cxfrs://http://abc.com/" + < header (test)>)
>
> Have you tried:
>
> .to(simple("cxfrs://http://abc.com/${header.test}"))
>
Re: How to get header parameter in a to route of camel
Posted by Alex Anderson <al...@frontlinesms.com>.
> from( "jms:request")
> .process(new AddHeader())
> .to("cxfrs://http://abc.com/" + < header (test)>)
Have you tried:
.to(simple("cxfrs://http://abc.com/${header.test}"))