|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MqttClientListener
Implement this interface to use SynchronousMqttClient
. The client will invoke the methods in this interface when a published message is received. A
single instance of this interface may be used with multiple clients.
Field Summary | |
---|---|
static MqttClientListener |
NULL_LISTENER
Use this listener when you want to ignore all client events including received messages. |
Method Summary | |
---|---|
void |
disconnected(MqttClient client,
Throwable cause,
boolean reconnecting)
Called when the connection to the broker is lost either unintentionally or because the client requested the disconnect. |
void |
publishReceived(MqttClient client,
PublishMessage message)
Called when a published message is received from the broker. |
Field Detail |
---|
static final MqttClientListener NULL_LISTENER
listener
when you want to ignore all client events including received messages. Any received messages will be
ack'd
.
Method Detail |
---|
void publishReceived(MqttClient client, PublishMessage message)
ack()
when you are done processing the
message. This is not required if the QoS
is QoS.AT_MOST_ONCE
but it is a good practice to always call it.
client
- The client that received the messagemessage
- The message that was publishedvoid disconnected(MqttClient client, Throwable cause, boolean reconnecting)
client
- The client that was disconnectedcause
- The exception that caused the client to disconnect. Null if there was no exception.reconnecting
- True if the client will attempt to reconnect. False if either all reconnect attempts have failed or the disconnect was not because of an
exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |