Hi,
I'm currently developing my first server based on Mina. Now I've some
questions about practical implementation details. I hope, that somebody
can give me some useful hints:
1. I found the multiton package. When I'm right, then it can be used in
cases, where I want to add an own session handler to each of my
sessions. Now the questions:
a) How can I do that (short example)?
b) Which usecase you can imagine (when I'm right, this way uses much
more resources on my computer. Right?)
2. I want to communicate with some hardware devices (>=5000). The
sessions will be opened ideally 24 hours a day. The devices communicate
over an ASCII protocol. The protocol has two embedded stages. The outer
stage defines the type of the message (command response, device message
...) The inner stage contains messages of an simpler format (each line
contains one welldefined NMEA protocol entry - GPRMC, GPGGA ...)
sample:
+cmd1
-msg1
-msg2
+cmd2
-msg3
I thought, that using a derived DemuxProtocolHandler could be a good
idea in this case. Now the questions:
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?
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)
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?
Ok, I hope, that you can help me a little bit for the startup :)
What I can say for the moment is: My first (old) server still works. But
the concepts behind this (MINA) project looks so clean for me, that I
will rewrite it once more with different goals in mind: Scalability,
speed, customization and wellformed API's, that make it possible to
reduce documentation overhead (make it simple).
Thanx
Michael