Hello MINA users,
    I am implementing a fairly complex protocol - complex enough to make a 
switch statement in my subclassed ProtocolHander very ugly. And so I'd 
like to use MINA's org.apache.mina.filter.codec.demux package. I've 
googled through the message archives & looked through the sumup example, & 
I have a general idea about how it works, but I still have some questions. 

        1. Should there be a separate Message class for every subtype of 
message, or for each general category of messages? For instance, there is 
a broad category of "LOGIN" messages, which can be broken up into 
"LOGIN_RQST," "LOGIN_ACK," and "LOGIN_NAK." Should I have a simple 
LoginMessage class or a LoginRqstMessage, LoginAckMessage, and 
LoginNakMessage? I am conflicted because while it seems like overkill to 
have an Encoder/Decoder pair for each of LoginRqstMessage, 
LoginAckMessage, and LoginNakMessage, it doesn't seem to me that all of 
the functionality provided by LOGIN_RQST, LOGIN_ACK, and LOGIN_NAK fits 
comfortably into one class (namely LoginMessage).
        2. How have people dealt with supporting multiple versions of 
protocols? My first instinct is to subclass further by having 
LoginMessageV1 & LoginMessageV2 which extend LoginMessage which extends 
AbstractMessage. The only thing is that the decoder/encoder pairs for 
LoginMessageV1 & LoginMessageV2 will be very different, so that's even 
more classes. And I don't want to fragment my code into too many classes, 
for both readability's sake and performance.

If anyone could point me to specific threads dealing with demuxing & 
codecs, or any other resources they think would be helpful, I would 
greatly appreciate it.

Best regards,

Elizabeth Clause
Email: [EMAIL PROTECTED]

Reply via email to