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: How do i call an HTTP Provider end-pont from the process method?
Date Fri, 09 Jan 2009 02:25:49 GMT
Hi ,

How about using the camel http producer directly ?

 from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
                .setBody(constant(".....................Liav Camel
 POC.......................")).to("http://YourHttpEndpointAddress");

Willem

Claus Ibsen wrote:
> Hi
> 
> You can use the producer template to call an external http server and
> get the response.
> 
> See this tutorial:
> http://activemq.apache.org/camel/tutorial-axis-camel.html
> 
>>>From the section - integrating Camel
> 
> Its kinda the same but its just uses the producer template to save a
> file. Its the same API for using any of the camel components.
> 
> Little sidenote:
> And since you use InOut you should use: requestBody instread of
> sendBody. However Camel is not to stricky about this yet so if you use
> a send instead of request then it should work as well.
> 
> The demo shows how to inject a producer template from spring into your
> bean class = your processor. when you have this template you can call
> the external http server and get the response using the requestBody
> method.
> 
> 
> 
> 
> 
> 
> 
> On Thu, Jan 8, 2009 at 1:46 PM, Liav Ezer <liav.ezer@gmail.com> wrote:
>> Hi,
>>
>> Here is my camel-context:
>>
>>  <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>    <package>org.apache.servicemix.tutorial.camel</package>
>>  </camelContext>
>>
>>  <bean id="myProcessor"
>> class="org.apache.servicemix.tutorial.camel.MyProcessor"/>
>>
>> Here is my RouteBuilder java file:
>>
>> public class MyRouteBuilder extends RouteBuilder {
>>        public void configure() {
>>        from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
>>                .setBody(constant(".....................Liav Camel
>> POC......................."))
>>                        .to("myProcessor");
>>
>>    }
>> }
>>
>> Here is my processor java file:
>> public class MyProcessor implements Processor {
>>          public void process(Exchange exchange) throws Exception {
>>              //WANT TO INITIATE A CALL TO http pROVIDER END POINT & PASS THE
>> 'FROM'
>>                  // PARAMETRS RECIEVED PROIRE TO THE PROCESSOR INVOKE.   }
>> }
>>
>> Thanks.
>> --
>> View this message in context: http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21351142.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 


Mime
View raw message