Class MqttServer
- java.lang.Object
-
- io.vertx.mutiny.mqtt.MqttServer
-
public class MqttServer extends Object
An MQTT serverYou can accept incoming MQTT connection requests providing a
NOTE: This class has been automatically generated from theendpointHandler(java.util.function.Consumer<io.vertx.mutiny.mqtt.MqttEndpoint>). As the requests arrive, the handler will be called with an instance ofMqttEndpointin order to manage the communication with the remote MQTT client.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<MqttServer>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description MqttServer(io.vertx.mqtt.MqttServer delegate)MqttServer(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intactualPort()io.smallrye.mutiny.Uni<Void>close()Close the server supplying an handler that will be called when the server is actually closed (or has failed).VoidcloseAndAwait()Blocking variant ofclose().voidcloseAndForget()Variant ofclose()that ignores the result of the operation.static MqttServercreate(Vertx vertx)static MqttServercreate(Vertx vertx, io.vertx.mqtt.MqttServerOptions options)MqttServerendpointHandler(Consumer<MqttEndpoint> handler)booleanequals(Object o)MqttServerexceptionHandler(Consumer<Throwable> handler)io.vertx.mqtt.MqttServergetDelegate()inthashCode()io.smallrye.mutiny.Uni<MqttServer>listen()Start the server listening for incoming connections using the specified options through the constructorio.smallrye.mutiny.Uni<MqttServer>listen(int port)Start the server listening for incoming connections on the port specified but on "0.0.0.0" as host.io.smallrye.mutiny.Uni<MqttServer>listen(int port, String host)Start the server listening for incoming connections on the port and host specified It ignores any options specified through the constructorMqttServerlistenAndAwait()Blocking variant oflisten(int, java.lang.String).MqttServerlistenAndAwait(int port)Blocking variant oflisten(int).MqttServerlistenAndAwait(int port, String host)Blocking variant oflisten(int,String).MqttServerlistenAndForget()Variant oflisten(int, java.lang.String)that ignores the result of the operation.MqttServerlistenAndForget(int port)Variant oflisten(int)that ignores the result of the operation.MqttServerlistenAndForget(int port, String host)Variant oflisten(int,String)that ignores the result of the operation.static MqttServernewInstance(io.vertx.mqtt.MqttServer arg)StringtoString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<MqttServer> __TYPE_ARG
-
-
Constructor Detail
-
MqttServer
public MqttServer(io.vertx.mqtt.MqttServer delegate)
-
MqttServer
public MqttServer(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.mqtt.MqttServer getDelegate()
-
create
public static MqttServer create(Vertx vertx, io.vertx.mqtt.MqttServerOptions options)
- Parameters:
vertx- Vert.x instanceoptions- MQTT server options- Returns:
- MQTT server instance
-
create
public static MqttServer create(Vertx vertx)
- Parameters:
vertx- Vert.x instance- Returns:
- MQTT server instance
-
listen
public io.smallrye.mutiny.Uni<MqttServer> listen(int port, String host)
Start the server listening for incoming connections on the port and host specified It ignores any options specified through the constructorUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
port- the port to listen onhost- the host to listen on- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public MqttServer listenAndAwait(int port, String host)
Blocking variant oflisten(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- the port to listen onhost- the host to listen on- Returns:
- the MqttServer instance produced by the operation.
-
listenAndForget
public MqttServer listenAndForget(int port, String host)
Variant oflisten(int,String)that ignores the result of the operation.This method subscribes on the result of
listen(int,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int,String)but you don't need to compose it with other operations.- Parameters:
port- the port to listen onhost- the host to listen on- Returns:
- the instance of MqttServer to chain method calls.
-
listen
public io.smallrye.mutiny.Uni<MqttServer> listen(int port)
Start the server listening for incoming connections on the port specified but on "0.0.0.0" as host. It ignores any options specified through the constructorUnlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
port- the port to listen on- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public MqttServer listenAndAwait(int port)
Blocking variant oflisten(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:
port- the port to listen on- Returns:
- the MqttServer instance produced by the operation.
-
listenAndForget
public MqttServer listenAndForget(int port)
Variant oflisten(int)that ignores the result of the operation.This method subscribes on the result of
listen(int), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int)but you don't need to compose it with other operations.- Parameters:
port- the port to listen on- Returns:
- the instance of MqttServer to chain method calls.
-
listen
public io.smallrye.mutiny.Uni<MqttServer> listen()
Start the server listening for incoming connections using the specified options through the constructorUnlike 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.
-
listenAndAwait
public MqttServer listenAndAwait()
Blocking variant oflisten(int, java.lang.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).
- Returns:
- the MqttServer instance produced by the operation.
-
listenAndForget
public MqttServer listenAndForget()
Variant oflisten(int, java.lang.String)that ignores the result of the operation.This method subscribes on the result of
listen(int, java.lang.String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int, java.lang.String)but you don't need to compose it with other operations.- Returns:
- the instance of MqttServer to chain method calls.
-
endpointHandler
public MqttServer endpointHandler(Consumer<MqttEndpoint> handler)
- Parameters:
handler- the endpoint handler- Returns:
-
exceptionHandler
public MqttServer exceptionHandler(Consumer<Throwable> handler)
- Parameters:
handler- the exception handler- Returns:
-
actualPort
public int actualPort()
- Returns:
- the actual port the server is listening on.
-
close
public io.smallrye.mutiny.Uni<Void> close()
Close the server supplying an handler that will be called when the server is actually closed (or has failed).Unlike 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.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofclose().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.
-
closeAndForget
public void closeAndForget()
-
newInstance
public static MqttServer newInstance(io.vertx.mqtt.MqttServer arg)
-
-