camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: CAMEL Servlet Endpoint
Date Tue, 21 Oct 2008 15:34:32 GMT
Hi

About the reponse. You should not add a 2nd route for the response.

Camel will return the response as the OUT message of the exchange. So your route should just
be these two lines:

<from uri="FROM_ENDPOINT" />
<process ref="myProcessor" />


And then the response is the OUT from myProcessor

Public void process(Exchange exchange) {
   String body = exchange.getIn().getBody(String.class);
   // do something with input
   String reply = "Bye World";
   exchange.getOut().setBody(reply);
   // now the reply will be Bye World as it's the OUT message
}

When using OUT it is important that you use the requestBody method (requestXXX) methods on
the producer template as they are for InOut exhange patterns.



So this in your spring xml should be removed = not needed.


<!-- route for the response ??? is it correct -->
			<from uri="TO_ENDPOINT" />
			<process ref="myResponseProcessor" />
			<to uri="FROM_ENDPOINT" />


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: GLD [mailto:guillaume.lundy@orange-ftgroup.com] 
Sent: 21. oktober 2008 14:37
To: camel-user@activemq.apache.org
Subject: Re: CAMEL Servlet Endpoint


Hi Claus, 
Thanks for the reply.

when you say 
> If you create your own servlets then of course you can identify it 
> and thus should know what [MY CONSUMER ENDPOINT] it is from. 
> You can get the http request and thus also the requested
> path/context/query string, etc.

>>>
in a concrete way, how should I do?
I cannot use a Bean Endpoint. what should I put in "from" tag

I created my servlet, a bean that implements the service. And I would like
to send the http body to the "from" tag of the route. could y


see attached Zip file 
http://www.nabble.com/file/p20089260/camel_question.zip camel_question.zip 


Regards.



James.Strachan wrote:
> 
> BTW the camel-http library has a Camel servlet that can be used for
> routing servlet invocations into Camel...
> http://activemq.apache.org/camel/http.html
> 
> as does the Jetty component
> http://activemq.apache.org/camel/jetty.html
> 
> 
> 2008/10/21 Claus Ibsen <ci@silverbullet.dk>:
>> Hi
>>
>> Yeah to my knowledge this is not support in Camel. We discussed this on
>> the chat the other day. Please feel free to raise it in our bug tracker
>> (JIRA).
>>
>> If you create your own servlets then of course you can identify it and
>> thus should know what [MY CONSUMER ENDPOINT] it is from. You can get the
>> http request and thus also the requested path/context/query string, etc.
>>
>>
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>>
>> -----Original Message-----
>> From: GLD [mailto:guillaume.lundy@orange-ftgroup.com]
>> Sent: 21. oktober 2008 10:30
>> To: camel-user@activemq.apache.org
>> Subject: CAMEL Servlet Endpoint
>>
>>
>> Hi all,
>>
>> I want to embed Camel in a WebApp.  The web app will be hosted in an
>> application server like JONAS (/tomcat or JETTY) or Weblogic.
>>
>> I want to create a route like this
>>  <from   [MY CONSUMER ENDPOINT]  />
>>  <process ref="myProcessor" />
>>  <to [MY PRODUCER ENDPOINT] />
>>
>> As camel is embedded in a webapp, I want to use the web container of the
>> application server to listen to http request ( I.E, I want to configure a
>> servlet to listen httpRequests and send back httpResponses).
>>
>> Reading the doc, I didn't find the way to do this.
>> In examples, consumers are jetty or CXF but It seems they re create
>> another
>> http listener and I don't want it.
>>
>> I looked at the Axis example, It uses a ProducerTemplate
>> It is interesting but I don't know if I can use this kind of Producer
>> template to identify the [from] endpoint of a route.
>>
>> The Second part of the question is how do I create a route for the
>> response
>> received from my [MY PRODUCER ENDPOINT]
>>
>> Regards, guillaume
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CAMEL-Servlet-Endpoint-tp20085692s22882p20085692.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/CAMEL-Servlet-Endpoint-tp20085692s22882p20089260.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message