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&#39;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(&quot;framer&quot;, new LengthFieldBasedFrameDecoder(20480, 0, 4, 0 ,4));<br>        pipeline.addUpstreamHandler(&quot;decoder&quot;, new StringEncoder());<br>
        <br>        // add downstream handlers that process downstream events only<br>        pipeline.addDownstreamHandler(&quot;encoder&quot;, new StringEncoder());<br>        pipeline.addDownstreamHandler(&quot;lengthHeaderEncoder&quot;, 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(&quot;application&quot;, 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">&lt;<a href="mailto:tlee@redhat.com">tlee@redhat.com</a>&gt;</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 &lt;<a href="mailto:yanky.young@gmail.com">yanky.young@gmail.com</a>&gt; wrote:<br>
&gt; Hi, trustin:<br>
&gt;<br>
&gt; The updated user guide is pretty clear. Just one thing I am a bit confused.<br>
&gt; It is about upstream and downstream concept. I have read ChannelPipeline<br>
&gt; document. I can generally understand what&#39;s upstream and downstream about,<br>
&gt; but not very clear.<br>
&gt;<br>
&gt; the diagram is good for understanding, but I think it is about how the two<br>
&gt; kinds of events flow in the pipeline and in which order they are processed<br>
&gt; by handlers. The problem is why? why would the upstream event be processed<br>
&gt; from the first handler to the last handler? and why would the downstream<br>
&gt; event be processed in a reverse order? The essence is, when receiving<br>
&gt; protocol message, we usually decode raw bytes into frames, and then decode<br>
&gt; frames into string or other protocol object, and then process protocol<br>
&gt; object(application level); and when sending protocol message, we firstly<br>
&gt; build new protocol object(application level), and then encode into string or<br>
&gt; whatever protocol format, and finally encode into raw bytes. So, I wonder if<br>
&gt; the upstream and downstream naming will be clear here. How about<br>
&gt; ChannelInboundHandler/ChannelOutboundHandler? Just my thoughts. It would be<br>
&gt; 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 &#39;inbound&#39; and &#39;outbound&#39; - why didn&#39;t I<br>
choose them over &#39;upstream&#39; and &#39;downstream&#39;?  It&#39;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>
&gt; Another question is, why FrameDecoder extends SimpleChannelHandler?<br>
&gt; SimpleChannelHandler process both downstream and upstream events, but<br>
&gt; FrameEncoder seems just process upstream events, right?<br>
<br>
</div>Yes, it is.  I&#39;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>