Netty and HTTP asynchronous responses...

"Trustin Lee (이희승)" trustin at gmail.com
Tue Dec 15 11:42:37 EST 2009


Hi Jay,

On 2009/12/15 10:12 pm, Jay McGaffigan wrote:
> Thanks for your response Carl!
> 
> One question:
> 
>> Of course, you need somewhere to keep track of your open requests (channels)
>> and dispatch message to all open connections when you receive messages to
>> send.
> 
> Does netty already have something that would facilitate this?  (Does
> something like a channel group but for open requests help support
> this? or is a channel group a list of open requests?) Or is it a "roll
> your own" type of thing.

Netty doesn't have a special data structure for such use case because a
simple Queue of HttpRequest is just enough for HTTP.  All HTTP messages
are exchanged in FIFO manner by definition.  Please let me know if you
think there is a specific need for a helper type or data structure
dedicated to what you are trying to achieve.  It would be interesting to
discuss on such facilities. :)

HTH,
Trustin

> 2009/12/12 Carl Byström <cgbystrom at gmail.com>:
>> On Tue, Dec 8, 2009 at 5:34 PM, Jay McGaffigan <hooligan495 at gmail.com>
>> wrote:
>>>
>>> ...
>>> I guess my question is this... Does Netty have facilities in place
>>> already that facilitate the deferred response concept or should I
>>> expect that I will have to find a library elsewhere (or roll my own)
>>> to achieve this functionality on top of Netty?
>>> ...
>>
>> Sure, that's possible. Netty make a great Comet server.
>>
>> If you'd like to defer a response while waiting for a message to be sent,
>> just don't close the connection.
>> See the method writeReponse() in
>> http://anonsvn.jboss.org/repos/netty/trunk/src/main/java/org/jboss/netty/example/http/snoop/HttpRequestHandler.java
>> At the end the channel is closed. In the HTTP example, one channel is one
>> request.
>> You can skip the closing part and by doing that you keep the connection
>> open.
>>
>> By default, Netty spawns one I/O thread per processor to take advantage of
>> multi-core servers. As long as you don't do any synchronous I/O, you'll be
>> fine.
>>
>> --
>> Carl
>>
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>>
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20091216/9d6c37ee/attachment.bin 


More information about the netty-users mailing list