Hi bea, On 7/10/07, bea <[EMAIL PROTECTED]> 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
