Trustin,
Thanks for your quick response, I was away
on vacation though, such is my late response.
If I remember, the exception resulting
from the no decoder available was not being caught in my filter, I think it is
being caught inside Mina’s demuxer and not passed on, but I will double
check tomorrow. I guess I will look for a different way to handle invalid
messages other than a default decoder, for now.
Regards,
Colin
-----Original Message-----
From: Trustin Lee
[mailto:[EMAIL PROTECTED]
Sent: Thursday, December 22, 2005
4:09 AM
To: Apache Directory Developers
List; Colin Cullen
Subject: Re: MINA
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