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.
|
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 MaestroClient
MaestroConnectionException
- if unable to connect to the brokerpublic void disconnect() throws MaestroConnectionException
disconnect
in interface MaestroClient
MaestroConnectionException
- 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 MaestroClient
topic
- the topic to publish the messagenote
- the maestro note to publishMaestroConnectionException
- if failed to publish the messageMalformedNoteException
- in case of other I/O errorsThis documentation was released into the public domain.