Class MqttClientSessionImpl

    • Constructor Detail

      • MqttClientSessionImpl

        public MqttClientSessionImpl​(io.vertx.core.Vertx vertx,
                                     MqttClientSessionOptions options)
        Create a new instance, which is not started.
        Parameters:
        vertx - The vert.x instance to use.
        options - The client session options.
    • Method Detail

      • subscribe

        public io.vertx.core.Future<Integer> subscribe​(String topic,
                                                       RequestedQoS qos)
        Description copied from interface: MqttClientSession
        Subscribes to a single topic with related QoS level.
        Specified by:
        subscribe in interface MqttClientSession
        Parameters:
        topic - The topic to subscribe to.
        qos - The QoS to request from the server.
        Returns:
        current MQTT client session instance
      • unsubscribe

        public io.vertx.core.Future<Void> unsubscribe​(String topic)
        Description copied from interface: MqttClientSession
        Unsubscribe from receiving messages on given topic
        Specified by:
        unsubscribe in interface MqttClientSession
        Parameters:
        topic - Topic you want to unsubscribe from
        Returns:
        current MQTT client session instance
      • exceptionHandler

        public MqttClientSession exceptionHandler​(io.vertx.core.Handler<Throwable> exceptionHandler)
        Description copied from interface: MqttClientSession
        Sets handler which will be called in case of an exception
        Specified by:
        exceptionHandler in interface MqttClientSession
        Parameters:
        exceptionHandler - handler to call
        Returns:
        current MQTT client session instance
      • publishCompletionHandler

        public MqttClientSession publishCompletionHandler​(io.vertx.core.Handler<Integer> publishCompleteHandler)
        Description copied from interface: MqttClientSession
        Set the publish complete handler.
        Specified by:
        publishCompletionHandler in interface MqttClientSession
        Parameters:
        publishCompleteHandler - The new handler, will overwrite the old one.
        Returns:
        current MQTT client session instance
        See Also:
        MqttClient.publishCompletionHandler(Handler)
      • publishCompletionExpirationHandler

        public MqttClientSession publishCompletionExpirationHandler​(io.vertx.core.Handler<Integer> publishCompletionExpirationHandler)
        Description copied from interface: MqttClientSession
        Set the publish completion expiration handler.
        Specified by:
        publishCompletionExpirationHandler in interface MqttClientSession
        Parameters:
        publishCompletionExpirationHandler - The new handler, will overwrite the old one.
        Returns:
        current MQTT client session instance
        See Also:
        MqttClient.publishCompletionExpirationHandler(Handler)
      • publishCompletionUnknownPacketIdHandler

        public MqttClientSession publishCompletionUnknownPacketIdHandler​(io.vertx.core.Handler<Integer> publishCompletionUnknownPacketIdHandler)
        Description copied from interface: MqttClientSession
        Set the publish completion unknown packet id handler.
        Specified by:
        publishCompletionUnknownPacketIdHandler in interface MqttClientSession
        Parameters:
        publishCompletionUnknownPacketIdHandler - The new handler, will overwrite the old one.
        Returns:
        current MQTT client session instance
        See Also:
        MqttClient.publishCompletionUnknownPacketIdHandler(Handler)
      • messageHandler

        public MqttClientSession messageHandler​(io.vertx.core.Handler<io.vertx.mqtt.messages.MqttPublishMessage> messageHandler)
        Description copied from interface: MqttClientSession
        Sets handler which will be called each time server publish something to client
        Specified by:
        messageHandler in interface MqttClientSession
        Parameters:
        messageHandler - handler to call
        Returns:
        current MQTT client session instance
      • publish

        public io.vertx.core.Future<Integer> publish​(String topic,
                                                     io.vertx.core.buffer.Buffer payload,
                                                     io.netty.handler.codec.mqtt.MqttQoS qosLevel,
                                                     boolean isDup,
                                                     boolean isRetain)
        Description copied from interface: MqttClientSession
        Sends the PUBLISH message to the remote MQTT server
        Specified by:
        publish in interface MqttClientSession
        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:
        a Future completed after PUBLISH packet sent with packetid (not when QoS 0)