camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Jetty asynchronus and parallel processing
Date Tue, 13 Oct 2009 11:50:45 GMT
On Tue, Oct 13, 2009 at 12:26 PM, SwenVogel <swen.vogel@ypsystems.de> wrote:
>
> Hi,
>
> i want to receive data over an HTTP-POST request and immediately return, so
> the processing
> is done asynchronously. The client should receive a HTTP status code 200
> without any response data.
>
> I have the following two routes:
>
> 1.
> The route that receives the data, set some simple properties, and send the
> data
> to the message processing route.
>
> from(“jetty:http:/localhost:8080/test“)
>    .setProperty(…)
>    .setProperty(…)
>    .inOnly(“seda:messageProcessing“)
>
> 2.
> The message processing route do some post and pre processings and sends the
> message to
> endpoints that are determined at runtime, therefore i used the routing slip.
>
> from(“seda:messageProcessing“)
>    .threads()
>    .process(…)
>    .routingSlip()
>    .process()
>
> In the second route (seda:messageProcessing) i used the threads DSL to
> enable parallel  processing,
> but i cannot figure out if this ist the correct way!
>
> The problem with this solution ist that the jetty endpoint always returns
> the request data as response data.
>
> So when i send:
>
> <echo>
>        Apache Camel is cool!
> </echo>
>
> I get back:
>
> <echo>
>        Apache Camel is cool!
> </echo>
>

Just transform the message to what you want to return, in your case an
empty body then do

.transform(constant(""));

or maybe even a null
.transform(null);

 from(“jetty:http:/localhost:8080/test“)
    .setProperty(…)
    .setProperty(…)
    .inOnly(“seda:messageProcessing“)
    .transform(constant("")); // set empty response to http client





>
> --
> View this message in context: http://www.nabble.com/Jetty-asynchronus-and-parallel-processing-tp25870376p25870376.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message