users@jersey.java.net

[Jersey] Re: Jersey on netty?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 29 Aug 2013 17:49:20 +0200

Hi Jan,

On Aug 28, 2013, at 11:31 PM, janalgermissen1und1_at_mac.com wrote:

> Hi all,
>
> looking into possibilities to run Jersey on top of an async HTTP 'server' , e.g. netty.
>
> Is anyone aware of any effort trying to do this in production quality?

Using Grizzly HTTP container to run Jersey can be certainly considered production-quality:
https://github.com/jersey/jersey/tree/master/containers/grizzly2-http

Grizzly, like Netty, is a high-level NIO framework with lots of advanced features: http://grizzly.java.net/

>
> What I am not sure in general is whether the programming model of JAX-RS actually fits an async. container (set aside AsyncResponse).

From the moment I saw your earlier tweet on the subject, I really wonder what is your use case here :)

It almost seems that you do not want async processing, but non-blocking (and async) processing. If so, the current JAX-RS model would be hard to bend to support such task. I'm also afraid that it would be too low level. Maybe I'm wrong - sharing the concrete use case that you have in mind would certainly help.

>
> Has anyone tried and succeeded or failed?

There are some Jersey examples demonstrating how JAX-RS AsyncResponse can be used to do async processing:

Also Jersey proprietary generic chunked i/O as well as the SSE support (that builds on the Jersey chunked I/O) leverages async HTTP container facility keep the client connection open even after resource method is finished. Here are some pointers:

Async & chunked I/O docs - https://jersey.java.net/documentation/latest/async.html
SSE support doc - https://jersey.java.net/documentation/latest/sse.html

Some related Jersey examples:
https://github.com/jersey/jersey/tree/master/examples/server-async-standalone
https://github.com/jersey/jersey/tree/master/examples/server-async-managed
https://github.com/jersey/jersey/tree/master/examples/sse-item-store-webapp
https://github.com/jersey/jersey/tree/master/examples/sse-twitter-aggregator

HTH,
Marek

>
> Jan