Hi trustin:<br><br>thanks for the pointer of ACE. I am just not familiar with ACE terms.<br><br>I just get another idea for upstream and downstream things. When building a pipeline, I don't know exactly what kind of order I should use to add handlers, and when both upstream handlers and downstream handlers are added, it is more complicated to get a clear idea about the execution order of handlers. So how about adding two classes of handlers into different handlers collection, like:<br>
<br> // add upstream handers that process upstream events only<br> pipeline.addUpstreamHandler("framer", new LengthFieldBasedFrameDecoder(20480, 0, 4, 0 ,4));<br> pipeline.addUpstreamHandler("decoder", new StringEncoder());<br>
<br> // add downstream handlers that process downstream events only<br> pipeline.addDownstreamHandler("encoder", new StringEncoder());<br> pipeline.addDownstreamHandler("lengthHeaderEncoder", new LengthFieldPrepender(4));<br>
<br> // when it comes to the end of filter chain, our business logic handler takes over. Note: MyApplicationHandler is supposed to process both upstream and downstream events <br> pipeline.addApplicationHandler("application", new MyApplicationHandler());<br>
<br>This kind of handlers chain seems more clear. Just my 2 cents.<br><br>yanky<br><br><div class="gmail_quote">2009/4/17 Trustin Lee <span dir="ltr"><<a href="mailto:tlee@redhat.com">tlee@redhat.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Yanky,<br>
<div class="im"><br>
On Thu, Apr 16, 2009 at 3:52 PM, yanky young <<a href="mailto:yanky.young@gmail.com">yanky.young@gmail.com</a>> wrote:<br>
> Hi, trustin:<br>
><br>
> The updated user guide is pretty clear. Just one thing I am a bit confused.<br>
> It is about upstream and downstream concept. I have read ChannelPipeline<br>
> document. I can generally understand what's upstream and downstream about,<br>
> but not very clear.<br>
><br>
> the diagram is good for understanding, but I think it is about how the two<br>
> kinds of events flow in the pipeline and in which order they are processed<br>
> by handlers. The problem is why? why would the upstream event be processed<br>
> from the first handler to the last handler? and why would the downstream<br>
> event be processed in a reverse order? The essence is, when receiving<br>
> protocol message, we usually decode raw bytes into frames, and then decode<br>
> frames into string or other protocol object, and then process protocol<br>
> object(application level); and when sending protocol message, we firstly<br>
> build new protocol object(application level), and then encode into string or<br>
> whatever protocol format, and finally encode into raw bytes. So, I wonder if<br>
> the upstream and downstream naming will be clear here. How about<br>
> ChannelInboundHandler/ChannelOutboundHandler? Just my thoughts. It would be<br>
> better to make netty API more clear or more intuitive.<br>
<br>
</div>The term upstream and downstream stem from ACE framework:<br>
<a href="http://www.cs.wustl.edu/%7Eschmidt/PDF/SUG-94.pdf" target="_blank">http://www.cs.wustl.edu/~schmidt/PDF/SUG-94.pdf</a> (See figure 11)<br>
<br>
However, I like the word 'inbound' and 'outbound' - why didn't I<br>
choose them over 'upstream' and 'downstream'? It's too late to<br>
renaming the whole classes and methods. So.. the documentation needs<br>
to clarify their meaning even more.<br>
<div class="im"><br>
> Another question is, why FrameDecoder extends SimpleChannelHandler?<br>
> SimpleChannelHandler process both downstream and upstream events, but<br>
> FrameEncoder seems just process upstream events, right?<br>
<br>
</div>Yes, it is. I've just updated all handler implementations extend<br>
SimpleChannelUpstreamHandler wherever possible.<br>
<br>
Thanks a bunch for the valuable feed back!<br>
<div><div></div><div class="h5"><br>
— Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
<br>
_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
</div></div></blockquote></div><br>