Class MqttServer

    • Constructor Detail

      • MqttServer

        public MqttServer​(io.vertx.mqtt.MqttServer delegate)
      • MqttServer

        public MqttServer​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.mqtt.MqttServer getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static MqttServer create​(Vertx vertx,
                                        io.vertx.mqtt.MqttServerOptions options)
        Parameters:
        vertx - Vert.x instance
        options - 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 constructor

        Unlike 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
        host - the host to listen on
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • listenAndAwait

        public MqttServer listenAndAwait​(int port,
                                         String host)
        Blocking variant of listen(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 on
        host - the host to listen on
        Returns:
        the MqttServer instance produced by the operation.
      • listenAndForget

        public MqttServer listenAndForget​(int port,
                                          String host)
        Variant of listen(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 from listen(int,String) but you don't need to compose it with other operations.

        Parameters:
        port - the port to listen on
        host - 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 constructor

        Unlike 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

        public MqttServer listenAndAwait​(int port)
        Blocking variant of listen(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 of listen(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 from listen(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 constructor

        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.
      • listenAndAwait

        public MqttServer listenAndAwait()
        Blocking variant of listen(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.
      • 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 uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of close().

        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()
        Variant of close() that ignores the result of the operation.

        This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

      • newInstance

        public static MqttServer newInstance​(io.vertx.mqtt.MqttServer arg)