You can do both. For a simple protocol (i. e. with only one message
type) the Decoder/Encoder-Pair will probably handle all the stuff. A
more flexible and maintainable solution is to have a Codec that
dispatches handling to message classes, have a look at the SumUp example
which uses the DemuxingProtocolCodecFactory. Demuxing is done here by
comparing the Java-Class of the received message against the registered
classes but you can certainly implement your own dispatching algorithm
quite easily.
Mike
Michael Ramirez wrote:
Dear Mina-Dev,
I have a question reguarding the relationship between ProtocolFactory,
ProtocolEncoder/Decoder, and Messages. Should I create Protocol Decoder/Encoder
for the Protocol (e.g MySqlEncoder/Decoder) or for the messages (e.g
ResultsEncoder/Decoder, HandshakeDecoder)? I am trying to build a mental
picture of how things work together.
Michael Ramirez
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2ยข/min or less.
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.0/304 - Release Date: 07.04.2006