Blocking request/response with Netty

"이희승 (Trustin Lee)" trustin at gmail.com
Wed Jul 15 02:33:32 EDT 2009


Hi Tomasz,

On 07/14/2009 07:17 PM, Tomasz Blachowicz wrote:
> Hi all,
> 
> I'm having the difficulty trying to understand how to achieve blocking
> request/response with Netty. I'd like to implement something similar to HTTP
> Request/Response, so I started from HTTP client example form Netty code
> base. I can clearly understand what is going on there, except the one - how
> to match response with the request?
> 
> Maybe I'm missing something, but what I wanted to implement is the client
> that holds single connection to the server and multiple threads can use this
> single client to access to the server. Each thread can invoke the client
> method that is expected to synchronously return some response, similarly to
> the web browser.
> 
> I'm not too sure if my question is clear enough. I hope it is though. Are
> there any examples in the code that I could use a s a reference?

In HTTP, the first response corresponds to the first request and the
second response corresponds to the second response and so on.
Therefore, you could maintain a queue of sent requests, and poll the
request from the queue when you receive a response.  Then you can match
a request and response.

HTH,
Trustin



More information about the netty-users mailing list