mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Vermillard <jvermill...@gmail.com>
Subject Re: Read/Write Filterchain
Date Mon, 29 Jul 2013 13:17:28 GMT
On Mon, Jul 29, 2013 at 3:01 PM, Ashish <paliwalashish@gmail.com> wrote:
> On Mon, Jul 29, 2013 at 6:24 PM, Julien Vermillard <jvermillard@gmail.com>wrote:
>
>> On Mon, Jul 29, 2013 at 11:52 AM, Ashish <paliwalashish@gmail.com> wrote:
>> > On Mon, Jul 29, 2013 at 3:15 PM, Julien Vermillard <
>> jvermillard@gmail.com>wrote:
>> >
>> >> On Sun, Jul 28, 2013 at 4:20 PM, Ashish <paliwalashish@gmail.com>
>> wrote:
>> >> > On Sun, Jul 28, 2013 at 5:18 PM, Julien Vermillard <
>> >> jvermillard@gmail.com>wrote:
>> >> >
>> >> >> Hi,
>> >> >> Just  make a filter handling read,but bypass for write
>> >> >> and a filter handling write but bypass for read.
>> >> >>
>> >> >> If you extends AbstractIoFilter you just need to implement the
needed
>> >> >> event for each filter.
>> >> >>
>> >> >>
>> >> > Got it.. Did we dropped the idea of having different filter chains
for
>> >> > read/write?
>> >> >
>> >>
>> >> Yes, for the sake of simplicity: most of time if you transform in one
>> >> way, you need to do
>> >> it in the other way.
>> >>
>> >
>> > I might have missed the discussion for this. I am getting older :)
>> > What about the order in which it would be executed? Is it same as added
>> in
>> > chain like in MINA 2.0 or the other way round.
>>
>> The order is the same as MINA 2: read/open/close/idle/exception left
>> to right, write right to left.
>>
>
> I meant, if I have a Filter chain like
>
> Filter 1 -> Filter 2 - > IoHandler
>
> So a Read chain would be same as filter chain above. So when I write from
> IoHandler, would the sequence of processing be Filter 1 -> Filter 2
>
> or IoHandler -> Filter 2 -> Filter 1

this one :)
read/close/open/idle/exception : f1->f2->IoHandler
write : f2(messagewriting)->f1(messagewriting)-> socket then IoHandler
messageSent
>
>
>
>>
>> >
>> > We also need an example with Codecs. Would you have bandwidth to create
>> one?
>>
>> You have the CoAP codec for a datagram based codec (no accumulation).
>>
>> I'm working on a MQTT codec
>> :https://github.com/jvermillard/mqtt-experiment/tree/master/mqtt-codec/
>> but this one is a state machine with no accumulation, it's quite
>> tedious to understand.
>>
>> You are right, some simpler example is needed, probably using IoBuffer
>> for accumulation.
>> I'm not sure I'm willing to do it in the next days :)
>>
>
> No worries :)
>
>
>>
>> >>
>> >> By the way, after implementing a lot of protocols using mina, I learnt
>> >> something about IoFilter:
>> >> too much logic in IoFilters is a design smell. Each time I try to do
>> >> that it's ending in a big  refactoring for putting this logic in the
>> >> IoHandler :)
>> >>
>> >
>> > Avro codec is light, just want to understand the flow correctly to get a
>> > working example.
>>
>> The real PITA is when from a filter read event you want to write a
>> message, using session.write(..)
>> in a read message handling. And you are intermixing read chain walk
>> with a walk of the write chain.
>> It can raise some weird question like : do I partially bypass the
>> write filter in the end of the filter chain?
>>
>
> Hmm I just want understand it so that I can configure the codecs properly
> :) Not doing anything jazzy here ;)
>
>
>>
>> Julien
>>
>
>
>
> --
> thanks
> ashish
>
> Blog: http://www.ashishpaliwal.com/blog
> My Photo Galleries: http://www.pbase.com/ashishpaliwal

Mime
View raw message