Hi,

Goal
I would like to improve the reliability of our program using Mina.
>From the research and tests I have made, it seems:

 1.  TCP reliability is not enough for messages not to be lost.
 2.  Mina does not offer message sent acknowledgment.
 3.  Lost of connection can be detected with the IOException that Mina will 
throw in IoHandlerAdapter#exceptionCaught.
 4.  If the remote socket is closed when writing to it, Mina will throw an 
WriteToClosedSessionException in IoHandlerAdapter#exceptionCaught.

Based on these statements, I have made a program that will use a buffer in case 
Mina cannot send messages. When the reconnection is done, it will flush the 
buffer and then resend as normal.

Problems
This is my test. I send 100 messages at 1/sec. I removed the ethernet cable 
after the 39th messages, put it back a few seconds later. As a consequence, I 
lost some messages. Here are some elements that might help.

 1.  The written data are from messages 1 to 39 and from 55 to 100 (so some 
messages are lost).
 2.  The Mina server and client notice an IOException.
 3.  The Mina client gets the IOException way too late (after the 53th message).
 4.  The WriteToClosedSessionException that is supposed to contain all the 
messages that could not be sent contains only the messages from 55 to 58 
(expected from 40 to 58).

Questions

 1.  Are the above statements correct?
 2.  Is my workaround a good solution or does Mina already offer a better way 
of keeping messages before sending them in case of network error?

Thank you.

Yours sincerely,

Antoine

Reply via email to