Hi Colin,

2005/12/22, Colin Cullen <[EMAIL PROTECTED]>:
Thanks for such a great product in MINA.  I have been working extensively with 0.8 and I am very close to finishing a server with a semi-complex protocol.  This server is destined for production and I am releived that I have encountered very few problems (really none) regarding MINA.  A good understanding of the MINA code base is necessary when working with some of the more advanced features.

Thank you for using MINA, too.  Your feedback help MINA community so much.

My problem:

I am using both DemuxingProtocolCodecFactory and DemuxingProtocolHandler to good effect (thank you!).  What I would like to do is to define a default decoder for inbound messages, to handle inappropriate message types, allowing processig of these types to fit nicely into the design (maybe I am just missing it).  I am currently extending DemuxingProtocolCodecFactory and registering my codecs there, I have a decoder and handler for each 'valid' inbound msg type which I want to handle.  Any suggestions for registering a default msg type decoder.

There's no way to do this in MINA 0.8 unfortunately.  But in MINA 0.9, the exceptions thrown from ProtocolEncoder and ProtocolDecoder are easily distinguished; ProtocolEncoder throws ProtocolEncoderException and ProtocolDecoder throws ProtocolDecoderException.  So, you can handle invalid inbound messages in your exceptionCaught() handler.  Migrating your application to MINA 0.9 is quite easy, but you might experience some API changes until 1.0 is released.

If you're going to use MINA 0.8, then you'll have to use ProtocolViolationException, but this exception can be thrown from ProtocolEncoder, too.  Please make sure you don't throw any exceptions in your encoders.

Is this answer helpful?

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

Reply via email to