com.esf.net.mqtt.client.service
Interface IEsfMqttCallback


public interface IEsfMqttCallback


Method Summary
 void connectionLost()
          Notification that the client has lost its connection with the broker.
 void publishArrived(java.lang.String clientId, java.lang.String sensorId, java.lang.String topic, byte[] payload, int qos)
          Called by the MQTT session when it receives a publish message from the broker.
 void published(int pubId)
          Called by the MQTT session when a publish has been fully acknowledged by the broker, as appropriate for the quality of service.
 void subscribed(int subId)
          Called by the MQTT session when a subscribe has been fully acknowledged by the broker.
 void unsubscribed(int unsubId)
          Called by the MQTT session when an unsubscribe has been fully acknowledged by the broker.
 

Method Detail

publishArrived

void publishArrived(java.lang.String clientId,
                    java.lang.String sensorId,
                    java.lang.String topic,
                    byte[] payload,
                    int qos)
Called by the MQTT session when it receives a publish message from the broker.

Parameters:
clientId - A String representing the client ID
sensorId - A String representing the sensor ID.
topic - A String representing the topic the message arrived on
payload - A byte array representing the payload of the message.
qos - An integer representing the quality of service the message was published on

published

void published(int pubId)
Called by the MQTT session when a publish has been fully acknowledged by the broker, as appropriate for the quality of service. The published method is not called for QoS 0 publications.

Parameters:
pubId - The message id of the published message

subscribed

void subscribed(int subId)
Called by the MQTT session when a subscribe has been fully acknowledged by the broker.

Parameters:
subId - The message id of the subscribe message

unsubscribed

void unsubscribed(int unsubId)
Called by the MQTT session when an unsubscribe has been fully acknowledged by the broker.

Parameters:
unsubId - The message id of the unsubscribe message

connectionLost

void connectionLost()
                    throws java.lang.Exception
Notification that the client has lost its connection with the broker. For a generic client, it will rely on the implementation of this method to reconnect to the broker. In the case of a cloud client, the reconnection will be handled within the client and this method will only be used as a notification.

Throws:
java.lang.Exception - thrown if the reconnect attempt failed (generic client only).