com.eurotech.framework.data
Interface DataServiceListener


public interface DataServiceListener

Implementors of this interface will be able to handle DataService events such as notifications of connection establishing, message arrival, etc. In order to detect implementors, the DataService uses the The whiteboard pattern http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf.
All registered listeners are called synchronously by the DataService at the occurrence of the event. It expected that implementers of this interface do NOT perform long running tasks in the implementation of this interface.


Method Summary
 void onConnectionEstablished()
          Notifies that the DataService has established a connection.
 void onConnectionLost(Throwable cause)
          Notifies that the DataService has unexpectedly disconnected.
 void onDisconnected()
          Notifies that the DataService has cleanly disconnected.
 void onDisconnecting()
          Notifies that the DataService is about to cleanly disconnect.
 void onMessageArrived(String topic, byte[] payload, int qos, boolean retained)
          Notifies a message arrival.
 void onMessageConfirmed(int messageId, String topic)
          Confirms message delivery to the broker.
 void onMessagePublished(int messageId, String topic)
          Notifies the a message has been published.
 

Method Detail

onConnectionEstablished

void onConnectionEstablished()
Notifies that the DataService has established a connection.


onDisconnecting

void onDisconnecting()
Notifies that the DataService is about to cleanly disconnect. If something needs to be done in reaction to this event, e.g. publishing a special last message, it SHOULD be done before the method returns. As soon as the method returns the DataService will start disconnecting.


onDisconnected

void onDisconnected()
Notifies that the DataService has cleanly disconnected.


onConnectionLost

void onConnectionLost(Throwable cause)
Notifies that the DataService has unexpectedly disconnected.


onMessageArrived

void onMessageArrived(String topic,
                      byte[] payload,
                      int qos,
                      boolean retained)
Notifies a message arrival.

Parameters:
topic -
payload -
qos -
retained -

onMessagePublished

void onMessagePublished(int messageId,
                        String topic)
Notifies the a message has been published. There is no guarantee the message has been actually transmitted over the wire or that it eventually will. The only guarantee is that message byte have been passed to the underlying OS.

Parameters:
messageId -

onMessageConfirmed

void onMessageConfirmed(int messageId,
                        String topic)
Confirms message delivery to the broker.

Parameters:
messageId -


Copyright © 2013. All Rights Reserved.