On 6/22/06, peter royal <[EMAIL PROTECTED]> wrote:

On Jun 22, 2006, at 10:36 AM, Henrik Ă˜sterlund Gram wrote:
> So I end up with wanting to use an IoFilter to parse the 1st layer
> messages, then have an IoHandler process it (optionally sending
> keepalive messages and do other stuff for layer1), then I want it
> to go to another IoFilter that parses the 2nd layer message and
> then finally end up in the IoHandler for the 2nd layer protocol.
> In a way, similar in setup if you had to implement TCP + an
> application protocol.  How can this be done with MINA?  Simply
> putting the 1st layer protocol handler in a filter also?  That
> doesn't seem to be what's intented - having looked at the MINA
> presentation slides - but will it at least work?

I would suggest implementing each layer as an IoFilter. Just because
an IoFilter receives a message, it does not mean that it must pass
the message on. Thus, your layer 1 IoFilter can send our responses
for keep-alive without disturbing layer 2 and beyond.


You can also use the chain of responsibility pattern in your IoHandler
implementation.  Actually we implemented the framework for you:

http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/handler/chain/package-summary.html

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to