Class MqttClient
- java.lang.Object
- 
- io.vertx.mutiny.mqtt.MqttClient
 
- 
 public class MqttClient extends Object An MQTT client NOTE: This class has been automatically generated from theoriginalnon Mutiny-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static TypeArg<MqttClient>__TYPE_ARG
 - 
Constructor SummaryConstructors Constructor Description MqttClient(io.vertx.mqtt.MqttClient delegate)MqttClient(Object delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringclientId()MqttClientcloseHandler(Runnable closeHandler)io.smallrye.mutiny.Uni<MqttConnAckMessage>connect(int port, String host)Connects to an MQTT server calling connectHandler after connectionio.smallrye.mutiny.Uni<MqttConnAckMessage>connect(int port, String host, String serverName)Connects to an MQTT server calling connectHandler after connectionMqttConnAckMessageconnectAndAwait(int port, String host)Blocking variant ofconnect(int,String).MqttConnAckMessageconnectAndAwait(int port, String host, String serverName)Blocking variant ofconnect(int,String,String).MqttClientconnectAndForget(int port, String host)Variant ofconnect(int,String)that ignores the result of the operation.MqttClientconnectAndForget(int port, String host, String serverName)Variant ofconnect(int,String,String)that ignores the result of the operation.static MqttClientcreate(Vertx vertx)static MqttClientcreate(Vertx vertx, io.vertx.mqtt.MqttClientOptions options)io.smallrye.mutiny.Uni<Void>disconnect()Disconnects from the MQTT server calling disconnectHandler after disconnectionVoiddisconnectAndAwait()Blocking variant ofdisconnect().MqttClientdisconnectAndForget()Variant ofdisconnect()that ignores the result of the operation.booleanequals(Object o)MqttClientexceptionHandler(Consumer<Throwable> handler)io.vertx.mqtt.MqttClientgetDelegate()inthashCode()booleanisConnected()static MqttClientnewInstance(io.vertx.mqtt.MqttClient arg)MqttClientping()MqttClientpingResponseHandler(Runnable pingResponseHandler)io.smallrye.mutiny.Uni<Integer>publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)Sends the PUBLISH message to the remote MQTT serverIntegerpublishAndAwait(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)Blocking variant ofpublish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean).MqttClientpublishAndForget(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)Variant ofpublish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean)that ignores the result of the operation.MqttClientpublishCompletionExpirationHandler(Consumer<Integer> publishCompletionExpirationHandler)MqttClientpublishCompletionHandler(Consumer<Integer> publishCompletionHandler)MqttClientpublishCompletionUnknownPacketIdHandler(Consumer<Integer> publishCompletionPhantomHandler)MqttClientpublishHandler(Consumer<MqttPublishMessage> publishHandler)io.smallrye.mutiny.Uni<Integer>subscribe(String topic, int qos)Subscribes to the topic with a specified QoS levelio.smallrye.mutiny.Uni<Integer>subscribe(Map<String,Integer> topics)Subscribes to the topic and adds a handler which will be called after the request is sentIntegersubscribeAndAwait(String topic, int qos)Blocking variant ofsubscribe(String,int).IntegersubscribeAndAwait(Map<String,Integer> topics)Blocking variant ofsubscribe(Map).MqttClientsubscribeAndForget(String topic, int qos)Variant ofsubscribe(String,int)that ignores the result of the operation.MqttClientsubscribeAndForget(Map<String,Integer> topics)Variant ofsubscribe(Map)that ignores the result of the operation.MqttClientsubscribeCompletionHandler(Consumer<MqttSubAckMessage> subscribeCompletionHandler)StringtoString()io.smallrye.mutiny.Uni<Integer>unsubscribe(String topic)Unsubscribe from receiving messages on given topicIntegerunsubscribeAndAwait(String topic)Blocking variant ofunsubscribe(String).MqttClientunsubscribeAndForget(String topic)Variant ofunsubscribe(String)that ignores the result of the operation.MqttClientunsubscribeCompletionHandler(Consumer<Integer> unsubscribeCompletionHandler)
 
- 
- 
- 
Field Detail- 
__TYPE_ARGpublic static final TypeArg<MqttClient> __TYPE_ARG 
 
- 
 - 
Constructor Detail- 
MqttClientpublic MqttClient(io.vertx.mqtt.MqttClient delegate) 
 - 
MqttClientpublic MqttClient(Object delegate) 
 
- 
 - 
Method Detail- 
getDelegatepublic io.vertx.mqtt.MqttClient getDelegate() 
 - 
createpublic static MqttClient create(Vertx vertx, io.vertx.mqtt.MqttClientOptions options) - Parameters:
- vertx- Vert.x instance
- options- MQTT client options
- Returns:
- MQTT client instance
 
 - 
createpublic static MqttClient create(Vertx vertx) - Parameters:
- vertx- Vert.x instance
- Returns:
- MQTT client instance
 
 - 
connect@CheckReturnValue public io.smallrye.mutiny.Uni<MqttConnAckMessage> connect(int port, String host) Connects to an MQTT server calling connectHandler after connectionUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
connectAndAwaitpublic MqttConnAckMessage connectAndAwait(int port, String host) Blocking variant ofconnect(int,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- Returns:
- the MqttConnAckMessage instance produced by the operation.
 
 - 
connectAndForgetpublic MqttClient connectAndForget(int port, String host) Variant ofconnect(int,String)that ignores the result of the operation.This method subscribes on the result of connect(int,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(int,String)but you don't need to compose it with other operations.- Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
connect@CheckReturnValue public io.smallrye.mutiny.Uni<MqttConnAckMessage> connect(int port, String host, String serverName) Connects to an MQTT server calling connectHandler after connectionUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- serverName- the SNI server name
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
connectAndAwaitpublic MqttConnAckMessage connectAndAwait(int port, String host, String serverName) Blocking variant ofconnect(int,String,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- serverName- the SNI server name
- Returns:
- the MqttConnAckMessage instance produced by the operation.
 
 - 
connectAndForgetpublic MqttClient connectAndForget(int port, String host, String serverName) Variant ofconnect(int,String,String)that ignores the result of the operation.This method subscribes on the result of connect(int,String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(int,String,String)but you don't need to compose it with other operations.- Parameters:
- port- port of the MQTT server
- host- hostname/ip address of the MQTT server
- serverName- the SNI server name
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
disconnect@CheckReturnValue public io.smallrye.mutiny.Uni<Void> disconnect() Disconnects from the MQTT server calling disconnectHandler after disconnectionUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
disconnectAndAwaitpublic Void disconnectAndAwait() Blocking variant ofdisconnect().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Returns:
- the Void instance produced by the operation.
 
 - 
disconnectAndForgetpublic MqttClient disconnectAndForget() Variant ofdisconnect()that ignores the result of the operation.This method subscribes on the result of disconnect(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromdisconnect()but you don't need to compose it with other operations.- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
publish@CheckReturnValue public io.smallrye.mutiny.Uni<Integer> publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain) Sends the PUBLISH message to the remote MQTT serverUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- topic- topic on which the message is published
- payload- message payload
- qosLevel- QoS level
- isDup- if the message is a duplicate
- isRetain- if the message needs to be retained
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
publishAndAwaitpublic Integer publishAndAwait(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain) Blocking variant ofpublish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- topic- topic on which the message is published
- payload- message payload
- qosLevel- QoS level
- isDup- if the message is a duplicate
- isRetain- if the message needs to be retained
- Returns:
- the Integer instance produced by the operation.
 
 - 
publishAndForgetpublic MqttClient publishAndForget(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain) Variant ofpublish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean)that ignores the result of the operation.This method subscribes on the result of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompublish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean)but you don't need to compose it with other operations.- Parameters:
- topic- topic on which the message is published
- payload- message payload
- qosLevel- QoS level
- isDup- if the message is a duplicate
- isRetain- if the message needs to be retained
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
publishCompletionHandlerpublic MqttClient publishCompletionHandler(Consumer<Integer> publishCompletionHandler) - Parameters:
- publishCompletionHandler- handler called with the packetId
- Returns:
 
 - 
publishCompletionExpirationHandlerpublic MqttClient publishCompletionExpirationHandler(Consumer<Integer> publishCompletionExpirationHandler) - Parameters:
- publishCompletionExpirationHandler- the handler to call with the ID of the expired packet
- Returns:
 
 - 
publishCompletionUnknownPacketIdHandlerpublic MqttClient publishCompletionUnknownPacketIdHandler(Consumer<Integer> publishCompletionPhantomHandler) - Parameters:
- publishCompletionPhantomHandler- the handler to call with the unknown packet ID
- Returns:
 
 - 
publishHandlerpublic MqttClient publishHandler(Consumer<MqttPublishMessage> publishHandler) - Parameters:
- publishHandler- handler to call
- Returns:
 
 - 
subscribeCompletionHandlerpublic MqttClient subscribeCompletionHandler(Consumer<MqttSubAckMessage> subscribeCompletionHandler) - Parameters:
- subscribeCompletionHandler- handler to call. List inside is a granted QoS array
- Returns:
 
 - 
subscribe@CheckReturnValue public io.smallrye.mutiny.Uni<Integer> subscribe(String topic, int qos) Subscribes to the topic with a specified QoS levelUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- topic- topic you subscribe on
- qos- QoS level
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
subscribeAndAwaitpublic Integer subscribeAndAwait(String topic, int qos) Blocking variant ofsubscribe(String,int).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- topic- topic you subscribe on
- qos- QoS level
- Returns:
- the Integer instance produced by the operation.
 
 - 
subscribeAndForgetpublic MqttClient subscribeAndForget(String topic, int qos) Variant ofsubscribe(String,int)that ignores the result of the operation.This method subscribes on the result of subscribe(String,int), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsubscribe(String,int)but you don't need to compose it with other operations.- Parameters:
- topic- topic you subscribe on
- qos- QoS level
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
subscribe@CheckReturnValue public io.smallrye.mutiny.Uni<Integer> subscribe(Map<String,Integer> topics) Subscribes to the topic and adds a handler which will be called after the request is sentUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- topics- topics you subscribe on
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
subscribeAndAwaitpublic Integer subscribeAndAwait(Map<String,Integer> topics) Blocking variant ofsubscribe(Map).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- topics- topics you subscribe on
- Returns:
- the Integer instance produced by the operation.
 
 - 
subscribeAndForgetpublic MqttClient subscribeAndForget(Map<String,Integer> topics) Variant ofsubscribe(Map)that ignores the result of the operation.This method subscribes on the result of subscribe(Map), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsubscribe(Map)but you don't need to compose it with other operations.- Parameters:
- topics- topics you subscribe on
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
unsubscribeCompletionHandlerpublic MqttClient unsubscribeCompletionHandler(Consumer<Integer> unsubscribeCompletionHandler) - Parameters:
- unsubscribeCompletionHandler- handler to call with the packetid
- Returns:
 
 - 
unsubscribe@CheckReturnValue public io.smallrye.mutiny.Uni<Integer> unsubscribe(String topic) Unsubscribe from receiving messages on given topicUnlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
- topic- Topic you want to unsubscribe from
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
unsubscribeAndAwaitpublic Integer unsubscribeAndAwait(String topic) Blocking variant ofunsubscribe(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Parameters:
- topic- Topic you want to unsubscribe from
- Returns:
- the Integer instance produced by the operation.
 
 - 
unsubscribeAndForgetpublic MqttClient unsubscribeAndForget(String topic) Variant ofunsubscribe(String)that ignores the result of the operation.This method subscribes on the result of unsubscribe(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunsubscribe(String)but you don't need to compose it with other operations.- Parameters:
- topic- Topic you want to unsubscribe from
- Returns:
- the instance of MqttClient to chain method calls.
 
 - 
pingResponseHandlerpublic MqttClient pingResponseHandler(Runnable pingResponseHandler) - Parameters:
- pingResponseHandler- handler to call
- Returns:
 
 - 
exceptionHandlerpublic MqttClient exceptionHandler(Consumer<Throwable> handler) - Parameters:
- handler- the exception handler
- Returns:
 
 - 
closeHandlerpublic MqttClient closeHandler(Runnable closeHandler) - Parameters:
- closeHandler- handler to call
- Returns:
 
 - 
pingpublic MqttClient ping() - Returns:
- current MQTT client instance
 
 - 
clientIdpublic String clientId() - Returns:
- the client identifier
 
 - 
isConnectedpublic boolean isConnected() - Returns:
- if the connection between client and remote server is established/open
 
 - 
newInstancepublic static MqttClient newInstance(io.vertx.mqtt.MqttClient arg) 
 
- 
 
-