You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by bea <st...@yahoo.com> on 2007/07/10 04:14:03 UTC

Multi-layer protocol in mina?

Hello,

Is there some tutorial which explains how to implement a multi layer
protocol in mina? This is my first attempt at using Mina and my guess was
that I would implement a codec filter for each protocol and chain them
together. However, I find that I cannot add more than one codec filter to a
chain so what can I do?

Lets say I have a custom text-based protocol which I would like to have the
option of sending over different transport protocols. Today, I want it to go
over a plain socket but tomorrow, I may want to layer it over HTTP. How does
one do this with Mina?

Thanks for your help.


-- 
View this message in context: http://www.nabble.com/Multi-layer-protocol-in-mina--tf4053410.html#a11513793
Sent from the mina dev mailing list archive at Nabble.com.


Re: Multi-layer protocol in mina?

Posted by mat <fo...@gmail.com>.
http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a9946908

On 7/10/07, bea <st...@yahoo.com> wrote:
>
>
> Hello,
>
> Is there some tutorial which explains how to implement a multi layer
> protocol in mina? This is my first attempt at using Mina and my guess was
> that I would implement a codec filter for each protocol and chain them
> together. However, I find that I cannot add more than one codec filter to
> a
> chain so what can I do?
>
> Lets say I have a custom text-based protocol which I would like to have
> the
> option of sending over different transport protocols. Today, I want it to
> go
> over a plain socket but tomorrow, I may want to layer it over HTTP. How
> does
> one do this with Mina?
>
> Thanks for your help.
>
>
> --
> View this message in context:
> http://www.nabble.com/Multi-layer-protocol-in-mina--tf4053410.html#a11513793
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: Multi-layer protocol in mina?

Posted by Trustin Lee <tr...@gmail.com>.
On 7/11/07, bea <st...@yahoo.com> wrote:
>
> Thanks for the reply.
>
> So if I'm currently writing "protocolX" with the intention of adding a
> transport protocol under it later, I should NOT implement "protocolX" as
> codec filter or I will not be able to put any other protocol underneath it?
> I should write it instead as something that implements IoFilter directly?

I'd implement the codec for the 'protocolX' that doesn't depend on
Apache MINA first.  By doing so, you have more options to make various
combination of transport layer.

In MINA 2.0, you will be able to add more than one
ProtocolCodecFilter, so there won't be such a hassle.  Thanks for your
patience!

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: Multi-layer protocol in mina?

Posted by bea <st...@yahoo.com>.
Thanks for the reply.

So if I'm currently writing "protocolX" with the intention of adding a
transport protocol under it later, I should NOT implement "protocolX" as 
codec filter or I will not be able to put any other protocol underneath it?
I should write it instead as something that implements IoFilter directly?






Trustin Lee wrote:
> 
> Hi bea,
> 
> On 7/10/07, bea <st...@yahoo.com> wrote:
>>
>> Hello,
>>
>> Is there some tutorial which explains how to implement a multi layer
>> protocol in mina? This is my first attempt at using Mina and my guess was
>> that I would implement a codec filter for each protocol and chain them
>> together. However, I find that I cannot add more than one codec filter to
>> a
>> chain so what can I do?
>>
>> Lets say I have a custom text-based protocol which I would like to have
>> the
>> option of sending over different transport protocols. Today, I want it to
>> go
>> over a plain socket but tomorrow, I may want to layer it over HTTP. How
>> does
>> one do this with Mina?
> 
> You can insert one ProtocolCodecFilter with a codec that decodes
> incoming ByteBuffers into your favorite POJOs (message objects).  Once
> message objects are generated, you can insert a custom filter that
> translates a certain type of message objects.  By adding such filters
> after the ProtocolCodecFilter, you can implement a multi-layered
> protocol.
> 
> To illustrate the message flow:
> 
> ByteBuffer --[ProtocolCodecFilter]-->  FirstLayerMesssage --...
> ..--[YourFilter]--> SecondLayerMessage ....
> 
> Mat gave you a link to the related topic, but I felt like I need to
> provide an answer focused to your question.
> 
> HTH,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/Multi-layer-protocol-in-mina--tf4053410.html#a11528878
Sent from the mina dev mailing list archive at Nabble.com.


Re: Multi-layer protocol in mina?

Posted by Trustin Lee <tr...@gmail.com>.
Hi bea,

On 7/10/07, bea <st...@yahoo.com> wrote:
>
> Hello,
>
> Is there some tutorial which explains how to implement a multi layer
> protocol in mina? This is my first attempt at using Mina and my guess was
> that I would implement a codec filter for each protocol and chain them
> together. However, I find that I cannot add more than one codec filter to a
> chain so what can I do?
>
> Lets say I have a custom text-based protocol which I would like to have the
> option of sending over different transport protocols. Today, I want it to go
> over a plain socket but tomorrow, I may want to layer it over HTTP. How does
> one do this with Mina?

You can insert one ProtocolCodecFilter with a codec that decodes
incoming ByteBuffers into your favorite POJOs (message objects).  Once
message objects are generated, you can insert a custom filter that
translates a certain type of message objects.  By adding such filters
after the ProtocolCodecFilter, you can implement a multi-layered
protocol.

To illustrate the message flow:

ByteBuffer --[ProtocolCodecFilter]-->  FirstLayerMesssage --...
..--[YourFilter]--> SecondLayerMessage ....

Mat gave you a link to the related topic, but I felt like I need to
provide an answer focused to your question.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6