Hi tvhnet2013,

1. Since a message is handled by the Metadata Adapter associated to the current connection, a message can be sent only if a connection is currently active.
More precisely, it is possible to send a message if the current status is not "DISCONNECTED*". Moreover, as soon as the status switches again to "DISCONNECTED*", any message still pending is abandoned and the ClientMessageListener.onAbort event is fired.

So, you can call the sendMessage soon after the LightstreamerClient.connect but in this case you should arrange the appropriate recovery actions in case of failure (retry sending the message).
Please refer here for further details on the sendmessage lifecycle.


2. First you have to implement a ClientMessageListener and differentiate the behavior of your code based on the type of event to handle.

Handling is dependent upon your application context and the type of reject you have received, in particular if you can or not be sure that your Adapter has received the message or if the error is originated from the Adapter own.