Consider the following scenario:
1. C#/Java client connects to Broker.
2. Broker restarts
3. At this point the Connection object is not null, but its usable. It will throw an exception is the client tried to publish a message.
How do I check if a connection is usable or not? I have not had any luck looking at the API docs.
Sending a message is really the only way to test an existing connection that does not have an exception listener. What you want it to:
If a connection is only used for sending, then you need the ping or you won't know about the failure until the next message is sent.