public class MqttClientImpl extends Object implements MqttClient
| Constructor and Description |
|---|
MqttClientImpl(Vertx vertx,
MqttClientOptions options)
Constructor
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, createpublic MqttClientImpl(Vertx vertx, MqttClientOptions options)
vertx - Vert.x instanceoptions - MQTT client optionspublic Future<MqttConnAckMessage> connect(int port, String host)
MqttClientMqttClient.connect(int, String, Handler) but returns a Future of the asynchronous resultconnect in interface MqttClientpublic MqttClient connect(int port, String host, Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
MqttClient.connect(int, String, Handler) for more detailsconnect in interface MqttClientport - port of the MQTT serverhost - hostname/ip address of the MQTT serverconnectHandler - handler called when the asynchronous connect call endspublic Future<MqttConnAckMessage> connect(int port, String host, String serverName)
MqttClientMqttClient.connect(int, String, String, Handler) but returns a Future of the asynchronous resultconnect in interface MqttClientpublic MqttClient connect(int port, String host, String serverName, Handler<AsyncResult<MqttConnAckMessage>> connectHandler)
MqttClient.connect(int, String, String, Handler) for more detailsconnect in interface MqttClientport - port of the MQTT serverhost - hostname/ip address of the MQTT serverserverName - the SNI server nameconnectHandler - handler called when the asynchronous connect call endspublic Future<Void> disconnect()
MqttClient.disconnect() for more detailsdisconnect in interface MqttClientFuture of the asynchronous resultpublic MqttClient disconnect(Handler<AsyncResult<Void>> disconnectHandler)
MqttClient.disconnect(Handler) for more detailsdisconnect in interface MqttClientdisconnectHandler - handler called when asynchronous disconnect call endspublic Future<Integer> publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)
MqttClient.publish(String, Buffer, MqttQoS, boolean, boolean) for more detailspublish in interface MqttClienttopic - topic on which the message is publishedpayload - message payloadqosLevel - QoS levelisDup - if the message is a duplicateisRetain - if the message needs to be retainedFuture completed after PUBLISH packet sent with packetid (not when QoS 0)public MqttClient publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain, Handler<AsyncResult<Integer>> publishSentHandler)
MqttClient.publish(String, Buffer, MqttQoS, boolean, boolean, Handler) for more detailspublish in interface MqttClienttopic - 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 MqttClient publishCompletionHandler(Handler<Integer> publishCompletionHandler)
MqttClient.publishCompletionHandler(Handler) for more detailspublishCompletionHandler in interface MqttClientpublishCompletionHandler - handler called with the packetIdpublic MqttClient publishCompletionExpirationHandler(Handler<Integer> publishCompletionExpirationHandler)
The time to wait for an acknowledgement message can be configured using
MqttClientOptions.setAckTimeout(int).
If the client receives a PUBACK/PUBREC/PUBCOMP for a message after its completion
has expired, the handler registered using MqttClient.publishCompletionUnknownPacketIdHandler(Handler)
will be invoked.
Note that this behavior is outside the scope of the MQTT 3.1.1 specification. The client's default behavior is therefore to wait forever for the server's corresponding acknowledgement.
publishCompletionExpirationHandler in interface MqttClientpublishCompletionExpirationHandler - the handler to call with the ID of the expired packetpublic MqttClient publishCompletionUnknownPacketIdHandler(Handler<Integer> publishCompletionPhantomHandler)
publishCompletionUnknownPacketIdHandler in interface MqttClientpublishCompletionPhantomHandler - the handler to call with the unknown packet IDpublic MqttClient publishHandler(Handler<MqttPublishMessage> publishHandler)
MqttClient.publishHandler(Handler) for more detailspublishHandler in interface MqttClientpublishHandler - handler to callpublic MqttClient subscribeCompletionHandler(Handler<MqttSubAckMessage> subscribeCompletionHandler)
MqttClient.subscribeCompletionHandler(Handler) for more detailssubscribeCompletionHandler in interface MqttClientsubscribeCompletionHandler - handler to call. List inside is a granted QoS arraypublic Future<Integer> subscribe(String topic, int qos)
MqttClient.subscribe(String, int) for more detailssubscribe in interface MqttClienttopic - topic you subscribe onqos - QoS levelFuture completed after SUBSCRIBE packet sent with packetidpublic MqttClient subscribe(String topic, int qos, Handler<AsyncResult<Integer>> subscribeSentHandler)
MqttClient.subscribe(String, int, Handler) for more detailssubscribe in interface MqttClienttopic - topic you subscribe onqos - QoS levelsubscribeSentHandler - handler called after SUBSCRIBE packet sent with packetidpublic Future<Integer> subscribe(Map<String,Integer> topics)
MqttClient.subscribe(Map) for more detailssubscribe in interface MqttClienttopics - topics and related QoS levels to subscribe toFuture completed after SUBSCRIBE packet sent with packetidpublic MqttClient subscribe(Map<String,Integer> topics, Handler<AsyncResult<Integer>> subscribeSentHandler)
MqttClient.subscribe(Map, Handler) for more detailssubscribe in interface MqttClienttopics - topics you subscribe onsubscribeSentHandler - handler called after SUBSCRIBE packet sent with packetidpublic MqttClient unsubscribeCompletionHandler(Handler<Integer> unsubscribeCompletionHandler)
MqttClient.unsubscribeCompletionHandler(Handler) for more detailsunsubscribeCompletionHandler in interface MqttClientunsubscribeCompletionHandler - handler to call with the packetidpublic MqttClient unsubscribe(String topic, Handler<AsyncResult<Integer>> unsubscribeSentHandler)
MqttClient.unsubscribe(String, Handler) )} for more detailsunsubscribe in interface MqttClienttopic - Topic you want to unsubscribe fromunsubscribeSentHandler - handler called after UNSUBSCRIBE packet sentpublic Future<Integer> unsubscribe(String topic)
MqttClient.unsubscribe(String) )} for more detailsunsubscribe in interface MqttClienttopic - Topic you want to unsubscribe fromFuture completed after UNSUBSCRIBE packet sent with packetidpublic MqttClient pingResponseHandler(Handler<Void> pingResponseHandler)
MqttClient.pingResponseHandler(Handler) for more detailspingResponseHandler in interface MqttClientpingResponseHandler - handler to callpublic MqttClient exceptionHandler(Handler<Throwable> handler)
MqttClient.exceptionHandler(Handler) for more detailsexceptionHandler in interface MqttClienthandler - the exception handlerpublic MqttClient closeHandler(Handler<Void> closeHandler)
MqttClient.closeHandler(Handler) for more detailscloseHandler in interface MqttClientcloseHandler - handler to callpublic MqttClient ping()
MqttClient.ping() for more detailsping in interface MqttClientpublic String clientId()
clientId in interface MqttClientpublic boolean isConnected()
isConnected in interface MqttClientCopyright © 2021. All rights reserved.