|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.paho.client.mqttv3.MqttTopic
public class MqttTopic
Represents a topic destination, used for publish/subscribe messaging.
Constructor Summary | |
---|---|
MqttTopic(String name,
ClientComms comms)
|
Method Summary | |
---|---|
String |
getName()
Returns the name of the queue or topic. |
MqttDeliveryToken |
publish(byte[] payload,
int qos,
boolean retained)
Publishes a message on the topic. |
MqttDeliveryToken |
publish(MqttMessage message)
Publishes the specified message to this topic, but does not wait for delivery of the message to complete. |
String |
toString()
Returns a string representation of this topic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MqttTopic(String name, ClientComms comms)
Method Detail |
---|
public MqttDeliveryToken publish(byte[] payload, int qos, boolean retained) throws MqttException, MqttPersistenceException
MqttMessage
object with a byte array payload and the
specified QoS, and then publish it. All other values in the
message will be set to the defaults.
payload
- the byte array to use as the payloadqos
- the Quality of Service. Valid values are 0, 1 or 2.retained
- whether or not this message should be retained by the server.
IllegalArgumentException
- if value of QoS is not 0, 1 or 2.
MqttException
MqttPersistenceException
publish(MqttMessage)
,
MqttMessage.setQos(int)
,
MqttMessage.setRetained(boolean)
public MqttDeliveryToken publish(MqttMessage message) throws MqttException, MqttPersistenceException
token
can be used
to track the delivery status of the message. Once this method has
returned cleanly, the message has been accepted for publication by the
client. Message delivery will be completed in the background when a connection
is available.
message
- the message to publish
MqttException
MqttPersistenceException
public String getName()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |