camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: recipientList with POST and request body
Date Wed, 09 Jan 2013 01:54:56 GMT
Hi,

I'm afraid the recipientList will not meet your needs at this time.
As you need to change the Http method and request JSON body dynamically, current recipientList
just supports to change the Camel Endpoint URI dynamically.

So I suggest you to leverage the ProducerTemplate[1] in your customer bean, so you can get
full control of message header , body and the Camel Endpoint URI at same time.

[1]https://camel.apache.org/producertemplate.html  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, January 9, 2013 at 2:48 AM, Zemin Hu wrote:

> Hi,  
> I need to send request to a dynamically constructed URL list which provides
> RESTful web services. So my simplest need is to send POST requests with
> fixed JSON body, later I may need to construct different JSON body for each
> URL in the list as well, and since it's RESTful service, DELETE/PUT are also
> possible. how should I do it?
>  
> This is standard recipientList pattern from document:
> <route>
> <from uri="direct:a" />
> <recipientList delimiter=",">
> <header>myHeader</header>
> </recipientList>
> </route>
>  
> Should I do:
> <route>
> <from uri="servlet:///sendToRecipients" />
> <setHeader headerName="WEB_SERVICE_URLS">
> <constant>construct my urls here</constant>
> </setHeader>
> <setHeader headerName="CamelHttpMethod">
> <constant>POST</constant>
> </setHeader>
> <setHeader headerName="Content-Type">
> <constant>application/json</constant>
> </setHeader>
> <setBody>
> <constant>{"name":"fixed text"}</constant>
> </setBody>
> <recipientList delimiter=",">
> <header>WEB_SERVICE_URLS</header>
> </recipientList>
> </route>
>  
> Thanks for advice.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Mime
View raw message