Multiple ChannelPipelines per Channel

McCloud Duncan.Doyle at gmail.com
Sun Oct 18 16:17:21 EDT 2009


Hello Trustin,

Yes, that's exactly what I want to do. HttpMessageDecoder and Encoder do way
too much in this situation. However, HttpMessageDecoder provides exactly the
functionality I need in my 'analyses' phase. So I'd like to reuse the
functionality the decoder provides. That's why I would have liked to be able
to attach 2 pipelines to the same channel. One which does the proxying, and
the other pipeline which does the decoding so the Http messages can be
analyzed.

Writing my own decoder is a good alternative, I'll look into that. I was
also thinking to build a second 'analysis server' which does the decoding.
So, my proxy needs to send the message to the proxied server and my analysis
server. In that case, my analysis server can use the default
HttpMessageDecoder.

Thanks for the suggestion.

Regards,

Duncan





Trustin Lee wrote:
> 
> Hello,
> 
> If I understood correctly, you want to retain the original buffer and
> send it to the proxied server in verbatim.  Then HttpMessageDecoder
> does a lot of unnecessary job for your use case, so I'd recommend you
> to write your own decoder for maximum performance.  The decoder could
> be as simple as determining the beginning and end of an HTTP message,
> instead of decoding every attribute of the message.  You will not even
> need an encoder I guess then?
> 
> HTH
> 
> — Trustin Lee, http://gleamynode.net/
> 
> 
> 
> On Tue, Oct 13, 2009 at 6:30 AM, McCloud <Duncan.Doyle at gmail.com> wrote:
>>
>> Hello,
>>
>> I'm pretty new to Netty. I'm currently trying to build an HTTP proxy,
>> which
>> apart from receiving requests from a client and forwarding them to the
>> proxied server (and vice versa for the response), is able to decode the
>> data
>> into HttpRequest and HttpResponse messages. These messages will later
>> used
>> to analyse response time, etc. in a different (remote) component.
>>
>> I based the initial version on the proxy example supplied by Netty (I
>> slightly modified the structure). The example provided just dumps the
>> data
>> in Hex format. Then I noticed the Http examples, which use the
>> HttpRequestEncoder and Decoder classes. I don't however want to first
>> decode
>> and then encode the proxied data due to possible performance issues, I
>> want
>> the proxy to be as fast as possible.
>>
>> So my idea was to attach 2 ChannelPipelines to the same Channel (for both
>> the server side and client side channels). One pipeline is responsible
>> for
>> the proxy functionality, the other pipeline is responsible for decoding
>> the
>> data into HttpRequests (on the server side channel) and HttpResponses (on
>> the client side channel) and sending the data to a remote component for
>> analysis. Both ChannelPipelines will use their own Executor (or Thread).
>>
>> Is this possible in Netty with the default API, or do I need to extend
>> the
>> framework in one way or the other.
>>
>> Regards,
>>
>> Duncan
>> --
>> View this message in context:
>> http://n2.nabble.com/Multiple-ChannelPipelines-per-Channel-tp3810809p3810809.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> 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
> 
> 

-- 
View this message in context: http://n2.nabble.com/Multiple-ChannelPipelines-per-Channel-tp3810809p3845727.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list