Hi,

First let me thank for your detailed answer. There are only a few things I want to ask you more.

Niklas Therning wrote:

When you say DemuxProtocolHandler you are referring to the things in the
org.apache.mina.filter.codec.demux package, right?

Right :)


a) Because all messages are textline based, would it be a good idea to
insert a TextLineCodec before my own handler from the view of resource
and performance costs?


Yes, I think it would be a good idea. When using TextLineCodec the
message object passed to your messageReceived() method will be Strings
containg single lines. Later, if you find that TextLineCodec is a
bottleneck you could just replace it with a custom and more optimized
version and you won't have to change your IoHandler.

If you want to convert the Strings into higher level objects before
passing them on to your IoHandler you could override the decode() method
in TextLineDecoder and do some custom processing using your own
ProtocolDecoderOutput which delegates to the original
ProtocolDecoderOutput once it has converted the Strings.

The second way is my preferred way ( -> TextLineDecoder -> OwnDecoder -> IoHandler). Just for the right understanding: The generated ProtocolDecoderOutput (POJO) from TextLineDecoder sends directly to the IoHandler? So I can't use it as input for the next decoder in the chain? That is one of the points, which would be nice to be described in more detail in the documentation.

b) How can I handle such multistage protocols. Have you any
recommendations for me at this point (e.g. Decoder1 calls subdecoder2,
message1 contains message2 in it's body)


Hmmm, I'm not sure I follow you here. Could you describe this idea more?

No problem. I've found a solution for myself. It's only a normal code design problem, nothing which can or should solve Mina.

3. Because I want to write the decoded protocol values to a MySQL
database, I want to use your third use case (ThreadPoolFilter before and
after the SQL handler). I guess this is the right way. But at the moment
I can't imagine, how these filters work in this case. Do you know some
documents (or sample code) where I can study this stuff in more detail?


I'm not aware of any such documentation. Anyone else?

BTW, I'm assuming you are using at least MINA 0.9.3, right?

You are right.


HTH
/Niklas

Best Regards
Michael

Reply via email to