public class MaestroMqttClient extends Object implements MaestroClient
| Modifier | Constructor and Description |
|---|---|
protected |
MaestroMqttClient(org.eclipse.paho.client.mqttv3.MqttClient mqttClient)
Constructor (for testing)
|
|
MaestroMqttClient(String url)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect to the maestro broker
|
void |
disconnect()
Disconnects from the maestro broker
|
void |
publish(String topic,
MaestroNote note)
Publishes a message in the broker
|
protected void |
publish(String topic,
MaestroNote note,
int qos,
boolean retained)
Publishes a message in the broker.
|
protected void |
publish(String topic,
MaestroNote note,
int qos,
boolean retained,
MaestroNoteCallback postProcessCallback)
Publishes a message in the broker.
|
void |
subscribe(String topic,
int qos)
Subscribe to a topic
|
void |
unsubscribe(String topic)
Unsubscribe from a topic
|
public MaestroMqttClient(String url) throws MaestroException
url - Maestro broker URLMaestroException - if unable to create the clientprotected MaestroMqttClient(org.eclipse.paho.client.mqttv3.MqttClient mqttClient)
throws MaestroException
mqttClient - Maestro broker URLMaestroException - if unable to create the clientpublic void connect()
throws MaestroConnectionException
connect in interface MaestroClientMaestroConnectionException - if unable to connect to the brokerpublic void disconnect()
throws MaestroConnectionException
disconnect in interface MaestroClientMaestroConnectionException - if failed to disconnect cleanly (should be safe to ignore in most cases)protected void publish(String topic, MaestroNote note, int qos, boolean retained) throws MalformedNoteException, MaestroConnectionException
topic - the topic to publish the messagenote - the maestro note to publishqos - MQTT QoSretained - MQTT retained flagMaestroConnectionException - if failed to publish the messageMalformedNoteException - in case of other I/O errorsprotected void publish(String topic, MaestroNote note, int qos, boolean retained, MaestroNoteCallback postProcessCallback) throws MalformedNoteException, MaestroConnectionException
topic - the topic to publish the messagenote - the maestro note to publishqos - MQTT QoSretained - MQTT retained flagpostProcessCallback - A call back action to be executed after the message was sentMaestroConnectionException - if failed to publish the messageMalformedNoteException - in case of other I/O errorspublic void publish(String topic, MaestroNote note) throws MalformedNoteException, MaestroConnectionException
publish in interface MaestroClienttopic - the topic to publish the messagenote - the maestro note to publishMaestroConnectionException - if failed to publish the messageMalformedNoteException - in case of other I/O errorspublic void subscribe(String topic, int qos)
topic - the topic to subscribeqos - the QOS for the topicpublic void unsubscribe(String topic)
topic - the topic to unsubscribe fromThis documentation was released into the public domain.