You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nicolas Palumbo <na...@gmail.com> on 2017/09/13 10:46:20 UTC

http get stream results

Hello guys,
I have a service that is currently serving via http get, doing a lot of
processing with camel gathering all the results in a big collection and
returning that as a json response for an http get request.
I'd like to keep the http get, but instead of blocking all the time til I
get the full collection, start streaming the elements as soon as they are
available to the http consumer.

What camel components can help me to do that? Is there any example around?

Thanks,
Nico

Re: http get stream results

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can get access to the http request / http response objects in some
of the camel components that are servlet api based and via that you
can via java code write to that response yourself.

Your use-case may be something where a regular Camel route is not
always the ideal as a only solution. But in what you do you can always
use Camel from Java code and call Camel components/endpoints and when
you have a response write that to the response stream yourself.

Also a framework like vert.x is very good for this kind of web / async
/ streaming stuff.
http://vertx.io/

And there is a camel-vertx component

And we coverage of using vertx and Camel in the Camel in Action 2nd
edition book in chapter 20.


And there is also web-socket protocol which is a bit better for
sending messages to http clients than a regular HTTP 1.1
request/response

On Wed, Sep 13, 2017 at 12:46 PM, Nicolas Palumbo <na...@gmail.com> wrote:
> Hello guys,
> I have a service that is currently serving via http get, doing a lot of
> processing with camel gathering all the results in a big collection and
> returning that as a json response for an http get request.
> I'd like to keep the http get, but instead of blocking all the time til I
> get the full collection, start streaming the elements as soon as they are
> available to the http consumer.
>
> What camel components can help me to do that? Is there any example around?
>
> Thanks,
> Nico



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2