Class MqttServer
- All Implemented Interfaces:
MutinyDelegate
You can accept incoming MQTT connection requests providing a endpointHandler(java.util.function.Consumer<io.vertx.mutiny.mqtt.MqttEndpoint>)
. As the
requests arrive, the handler will be called with an instance of MqttEndpoint
in order to manage the
communication with the remote MQTT client.
original
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
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).Blocking variant ofclose()
.void
Variant ofclose()
that ignores the result of the operation.static MqttServer
static MqttServer
endpointHandler
(Consumer<MqttEndpoint> handler) boolean
exceptionHandler
(Consumer<Throwable> handler) io.vertx.mqtt.MqttServer
int
hashCode()
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>
Start the server listening for incoming connections on the port and host specified It ignores any options specified through the constructorBlocking variant oflisten(int, java.lang.String)
.listenAndAwait
(int port) Blocking variant oflisten(int)
.listenAndAwait
(int port, String host) Blocking variant oflisten(int,String)
.Variant oflisten(int, java.lang.String)
that ignores the result of the operation.listenAndForget
(int port) Variant oflisten(int)
that ignores the result of the operation.listenAndForget
(int port, String host) Variant oflisten(int,String)
that ignores the result of the operation.static MqttServer
newInstance
(io.vertx.mqtt.MqttServer arg) toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
MqttServer
public MqttServer(io.vertx.mqtt.MqttServer delegate) -
MqttServer
-
-
Method Details
-
getDelegate
public io.vertx.mqtt.MqttServer getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
create
- Parameters:
vertx
- Vert.x instanceoptions
- MQTT server options- Returns:
- MQTT server instance
-
create
- Parameters:
vertx
- Vert.x instance- Returns:
- MQTT server instance
-
listen
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
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
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
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
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
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
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
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
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
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
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
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
- Parameters:
handler
- the endpoint handler- Returns:
-
exceptionHandler
- Parameters:
handler
- the exception handler- Returns:
-
actualPort
public int actualPort()- Returns:
- the actual port the server is listening on.
-
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
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
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
-