|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface class defines the methods that will be called if the simple callback mechanism is implemented. Using the simple callback interface a class can be notified of publications arriving and the TCP/IP connection unexpectedly terminating.
Method Summary | |
---|---|
void |
connectionLost(java.lang.Throwable cause)
Called by the MQTT session if the TCP/IP connection unexpectedly terminates This method should attempt to reconnect using the connect method. |
boolean |
publishArrived(java.lang.String topicName,
MqttPayload payload,
byte qos,
boolean retained,
int msgId)
Called by the MQTT session when it receives a publish message from the broker. |
Method Detail |
public void connectionLost(java.lang.Throwable cause)
If the client decides to give up trying to reconnect then this method should just return.
cause
- The Throwable which caused the connection to be declared lost.public boolean publishArrived(java.lang.String topicName, MqttPayload payload, byte qos, boolean retained, int msgId)
NOTE:
Any implementation of this method should NOT call any of the
other API methods as this will cause a deadlock. Blocking for a significant
amount of time is also not advised. If API calls or blocking are required in this method, then
the method should start up a new thread to do the work.
topicName
- The topic from which data was receivedpayload
- An object containing a byte array and start offset of the data received on the above topic.qos
- The Quality of Service at which the pulication was delivered by the brokerretained
- Is this a retained publication?msgId
- The MQTT message id of the received publication. This parameter can be used to minimise the number
of times the message is persisted when reliable message receipt is required. For QoS 1 and 2 publications
MqttPersistence.addReceivedMessage(MqttPersistentData)
persists the publication, so when this method is
called the msgId can be used to reference the already persisted message payload and thereby avoid the need for
the application to persist the MqttPayload passed into publishArrived.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |