Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<MqttClient> |
__TYPE_ARG |
Constructor and Description |
---|
MqttClient(MqttClient delegate) |
MqttClient(Object delegate) |
Modifier and Type | Method and Description |
---|---|
String |
clientId() |
MqttClient |
closeHandler(Handler<Void> closeHandler)
Set a handler that will be called when the connection with server is closed
|
MqttClient |
connect(int port,
String host,
Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
Connects to an MQTT server calling connectHandler after connection
|
MqttClient |
connect(int port,
String host,
String serverName,
Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
Connects to an MQTT server calling connectHandler after connection
|
static MqttClient |
create(Vertx vertx)
Return an MQTT client instance using the default options
|
static MqttClient |
create(Vertx vertx,
MqttClientOptions options)
Return an MQTT client instance
|
MqttClient |
disconnect()
Disconnects from the MQTT server
|
MqttClient |
disconnect(Handler<AsyncResult<Void>> disconnectHandler)
Disconnects from the MQTT server calling disconnectHandler after disconnection
|
boolean |
equals(Object o) |
MqttClient |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler for the client, that will be called when an error happens
in internal netty structures.
|
MqttClient |
getDelegate() |
int |
hashCode() |
boolean |
isConnected() |
static MqttClient |
newInstance(MqttClient arg) |
MqttClient |
ping()
This method is needed by the client in order to avoid server closes the
connection due to the keep alive timeout if client has no messages to send
|
MqttClient |
pingResponseHandler(Handler<Void> pingResponseHandler)
Sets handler which will be called after PINGRESP packet receiving
|
MqttClient |
publish(String topic,
Buffer payload,
io.netty.handler.codec.mqtt.MqttQoS qosLevel,
boolean isDup,
boolean isRetain)
Sends the PUBLISH message to the remote MQTT server
|
MqttClient |
publish(String topic,
Buffer payload,
io.netty.handler.codec.mqtt.MqttQoS qosLevel,
boolean isDup,
boolean isRetain,
Handler<AsyncResult<Integer>> publishSentHandler)
Sends the PUBLISH message to the remote MQTT server
|
MqttClient |
publishCompletionHandler(Handler<Integer> publishCompletionHandler)
Sets handler which will be called each time publish is completed
|
MqttClient |
publishHandler(Handler<MqttPublishMessage> publishHandler)
Sets handler which will be called each time server publish something to client
|
Single<MqttConnAckMessage> |
rxConnect(int port,
String host)
Connects to an MQTT server calling connectHandler after connection
|
Single<MqttConnAckMessage> |
rxConnect(int port,
String host,
String serverName)
Connects to an MQTT server calling connectHandler after connection
|
Single<Void> |
rxDisconnect()
Disconnects from the MQTT server calling disconnectHandler after disconnection
|
Single<Integer> |
rxPublish(String topic,
Buffer payload,
io.netty.handler.codec.mqtt.MqttQoS qosLevel,
boolean isDup,
boolean isRetain)
Sends the PUBLISH message to the remote MQTT server
|
Single<Integer> |
rxSubscribe(Map<String,Integer> topics)
Subscribes to the topic and adds a handler which will be called after the request is sent
|
Single<Integer> |
rxSubscribe(String topic,
int qos)
Subscribes to the topic with a specified QoS level
|
Single<Integer> |
rxUnsubscribe(String topic)
Unsubscribe from receiving messages on given topic
|
MqttClient |
subscribe(Map<String,Integer> topics)
Subscribes to the topics with related QoS levels
|
MqttClient |
subscribe(Map<String,Integer> topics,
Handler<AsyncResult<Integer>> subscribeSentHandler)
Subscribes to the topic and adds a handler which will be called after the request is sent
|
MqttClient |
subscribe(String topic,
int qos)
Subscribes to the topic with a specified QoS level
|
MqttClient |
subscribe(String topic,
int qos,
Handler<AsyncResult<Integer>> subscribeSentHandler)
Subscribes to the topic with a specified QoS level
|
MqttClient |
subscribeCompletionHandler(Handler<MqttSubAckMessage> subscribeCompletionHandler)
Sets handler which will be called after SUBACK packet receiving
|
String |
toString() |
MqttClient |
unsubscribe(String topic)
Unsubscribe from receiving messages on given topic
|
MqttClient |
unsubscribe(String topic,
Handler<AsyncResult<Integer>> unsubscribeSentHandler)
Unsubscribe from receiving messages on given topic
|
MqttClient |
unsubscribeCompletionHandler(Handler<Integer> unsubscribeCompletionHandler)
Sets handler which will be called after UNSUBACK packet receiving
|
public static final io.vertx.lang.rx.TypeArg<MqttClient> __TYPE_ARG
public MqttClient(MqttClient delegate)
public MqttClient(Object delegate)
public MqttClient getDelegate()
public static MqttClient create(Vertx vertx, MqttClientOptions options)
vertx
- Vert.x instanceoptions
- MQTT client optionspublic static MqttClient create(Vertx vertx)
vertx
- Vert.x instancepublic MqttClient connect(int port, String host, Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
port
- port of the MQTT serverhost
- hostname/ip address of the MQTT serverconnectHandler
- handler called when the asynchronous connect call endspublic Single<MqttConnAckMessage> rxConnect(int port, String host)
port
- port of the MQTT serverhost
- hostname/ip address of the MQTT serverpublic MqttClient connect(int port, String host, String serverName, Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
port
- port of the MQTT serverhost
- hostname/ip address of the MQTT serverserverName
- the SNI server nameconnectHandler
- handler called when the asynchronous connect call endspublic Single<MqttConnAckMessage> rxConnect(int port, String host, String serverName)
port
- port of the MQTT serverhost
- hostname/ip address of the MQTT serverserverName
- the SNI server namepublic MqttClient disconnect()
public MqttClient disconnect(Handler<AsyncResult<Void>> disconnectHandler)
disconnectHandler
- handler called when asynchronous disconnect call endspublic Single<Void> rxDisconnect()
public MqttClient publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)
topic
- topic on which the message is publishedpayload
- message payloadqosLevel
- QoS levelisDup
- if the message is a duplicateisRetain
- if the message needs to be retainedpublic MqttClient publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain, Handler<AsyncResult<Integer>> publishSentHandler)
topic
- topic on which the message is publishedpayload
- message payloadqosLevel
- QoS levelisDup
- if the message is a duplicateisRetain
- if the message needs to be retainedpublishSentHandler
- handler called after PUBLISH packet sent with packetid (not when QoS 0)public Single<Integer> rxPublish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)
topic
- topic on which the message is publishedpayload
- message payloadqosLevel
- QoS levelisDup
- if the message is a duplicateisRetain
- if the message needs to be retainedpublic MqttClient publishCompletionHandler(Handler<Integer> publishCompletionHandler)
publishCompletionHandler
- handler called with the packetIdpublic MqttClient publishHandler(Handler<MqttPublishMessage> publishHandler)
publishHandler
- handler to callpublic MqttClient subscribeCompletionHandler(Handler<MqttSubAckMessage> subscribeCompletionHandler)
subscribeCompletionHandler
- handler to call. List inside is a granted QoS arraypublic MqttClient subscribe(String topic, int qos)
topic
- topic you subscribe onqos
- QoS levelpublic MqttClient subscribe(String topic, int qos, Handler<AsyncResult<Integer>> subscribeSentHandler)
topic
- topic you subscribe onqos
- QoS levelsubscribeSentHandler
- handler called after SUBSCRIBE packet sent with packetidpublic Single<Integer> rxSubscribe(String topic, int qos)
topic
- topic you subscribe onqos
- QoS levelpublic MqttClient subscribe(Map<String,Integer> topics)
topics
- topics and related QoS levels to subscribe topublic MqttClient subscribe(Map<String,Integer> topics, Handler<AsyncResult<Integer>> subscribeSentHandler)
topics
- topics you subscribe onsubscribeSentHandler
- handler called after SUBSCRIBE packet sent with packetidpublic Single<Integer> rxSubscribe(Map<String,Integer> topics)
topics
- topics you subscribe onpublic MqttClient unsubscribeCompletionHandler(Handler<Integer> unsubscribeCompletionHandler)
unsubscribeCompletionHandler
- handler to call with the packetidpublic MqttClient unsubscribe(String topic)
topic
- Topic you want to unsubscribe frompublic MqttClient unsubscribe(String topic, Handler<AsyncResult<Integer>> unsubscribeSentHandler)
topic
- Topic you want to unsubscribe fromunsubscribeSentHandler
- handler called after UNSUBSCRIBE packet sentpublic Single<Integer> rxUnsubscribe(String topic)
topic
- Topic you want to unsubscribe frompublic MqttClient pingResponseHandler(Handler<Void> pingResponseHandler)
pingResponseHandler
- handler to callpublic MqttClient exceptionHandler(Handler<Throwable> handler)
io.netty.handler.codec.DecoderException
can be one of the causehandler
- the exception handlerpublic MqttClient closeHandler(Handler<Void> closeHandler)
closeHandler
- handler to callpublic MqttClient ping()
public String clientId()
public boolean isConnected()
public static MqttClient newInstance(MqttClient arg)
Copyright © 2020 Eclipse. All rights reserved.