A couple of questions about Netty internals

Mert İnan inanme at yahoo.com
Tue Nov 3 05:52:49 EST 2009


Thank you Truntin.

First i post to "Netty Developer Group", due to lack of response i thougth
may be i posted to wrong group. So i posted to "Netty User Group" and tried
to delete first post. but could not delete.

which group should newbies should post? 
here i tried to ask my questions in more detail. 


Trustin Lee wrote:
> 
> Thanks for your interest in Netty, but please do not double-post.
> Your second duplicate post has been discarded.
> 
> On Mon, Nov 2, 2009 at 3:44 PM, Mert İnan <inanme at yahoo.com> wrote:
>>
>> Hi Netty Developer Group,
>>
>> i am trying to get confortable with Netty(3.1.5). Here are a couple of
>> questions i come up with.
>>
>> 1. Data comes into netty, it goes up and down through handlers. There may
>> be
>> many ChannelUpstreamHandler and ChannelDownstreamHandler handlers. In all
>> those handlers,in general, should i use Channels.fireMessageReceived only
>> once? if so when? what happens if Channels.fireMessageReceived is called
>> more then once in up handlers?
> 
> 
> Trustin Lee wrote:
>> 
>> There's no restriction on how many times an event should be generated
>> by a handler.  This means, you can generate as many as events as you
>> want
>> 
> For example A handler fires X message, B handler receices it. B converts X
> to Y message.
> in B hanler X's lifecycle is over, Y message must go on to upper handlers.
> Bu i can not code this approach.
> 
> I could not find a way to kill X and forward Y from where X left. 
> 
>> 2. What should i do when my decoder constructed by more than one handler?
>> Is
>> it required that Decoder must be implemented in one handler?
> 
> 
> Trustin Lee wrote:
>> 
>> You can write a complex decoder with more than one handler.  That is,
>> you can combine multiple decoders to decode multi-layered protocols
>> for example.
>> 
> 
> how can i forward both the half decoded message and renaming buffer?
> Should i encupsulate them in a new class for example? 
> 
> 
>> 3. Why FrameDecoder.callDecode throws this Exception?
>>
>>                throw new IllegalStateException(
>>                        "decode() method must read at least one byte " +
>>                        "if it returned a frame (caused by: " + getClass()
>> +
>> ")");
> 
> 
> Trustin Lee wrote:
>> 
>> Decoding, by definition, reads something from the input and produces
>> the decoded data.  Therefore, you cannot create something from
>> nothing.
>> 
> 
> I want to separete roles of framer and decoder. As you said decoder always
> should read data.
> But framer should not i guess. Framer must ensure that enough data is
> received.
> in my case, i want to ensure that enough data is received without actually
> reading it and forward that data to decoder .
> 
> i hope i could express myself. 
> 
> 
> Trustin Lee wrote:
>> 
>> HTH
>> 
>> — Trustin Lee, http://gleamynode.net/
>> 
>> _______________________________________________
>> netty-dev mailing list
>> netty-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-dev
>> 
> 

-- 
View this message in context: http://n2.nabble.com/A-couple-of-questions-about-Netty-internals-tp3930218p3937712.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.



More information about the netty-dev mailing list