We are creating a message sending program in java that connects to an existing service running at a specific server.
It frequently checks if it can send and receive data from the url of the server.
If the connection is alive, the program can send messages to the url and log them into a database until a response for that message is received.
But once the connection is lost, the database should be cleared of all messages, since the other side also clears the messages received.
Any suggestions on this?
I am guessing you will get an exception when the connection is lost.
You should catch that exception, and in the exception you can clear your messages