Class MqttEndpoint


  • public class MqttEndpoint
    extends Object
    Represents an MQTT endpoint for point-to-point communication with the remote MQTT client

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • MqttEndpoint

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

        public MqttEndpoint​(Object delegate)
    • Method Detail

      • getDelegate

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

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

        public void close()
      • remoteAddress

        public SocketAddress remoteAddress()
        Returns:
        the remote address for this socket
      • localAddress

        public SocketAddress localAddress()
        Returns:
        the local address for this socket
      • isSsl

        public boolean isSsl()
        Returns:
        true if this MqttEndpoint is encrypted via SSL/TLS.
      • clientIdentifier

        public String clientIdentifier()
        Returns:
        the client identifier as provided by the remote MQTT client
      • auth

        public io.vertx.mqtt.MqttAuth auth()
        Returns:
        the Authentication information as provided by the remote MQTT client
      • will

        public io.vertx.mqtt.MqttWill will()
        Returns:
        the Will information as provided by the remote MQTT client
      • protocolVersion

        public int protocolVersion()
        Returns:
        the protocol version required by the remote MQTT client
      • protocolName

        public String protocolName()
        Returns:
        the protocol name provided by the remote MQTT client
      • isCleanSession

        public boolean isCleanSession()
        Returns:
        true when clean session is requested by the remote MQTT client
      • keepAliveTimeSeconds

        public int keepAliveTimeSeconds()
        Returns:
        the keep alive timeout (in seconds) specified by the remote MQTT client
      • lastMessageId

        public int lastMessageId()
        Returns:
        the message identifier used for last published message
      • subscriptionAutoAck

        public void subscriptionAutoAck​(boolean isSubscriptionAutoAck)
        Parameters:
        isSubscriptionAutoAck - auto acknowledge status
      • isSubscriptionAutoAck

        public boolean isSubscriptionAutoAck()
        Returns:
        true when auto acknowledge status for subscription/unsubscription requests
      • publishAutoAck

        public MqttEndpoint publishAutoAck​(boolean isPublishAutoAck)
        Parameters:
        isPublishAutoAck - auto acknowledge status
        Returns:
        a reference to this, so the API can be used fluently
      • isPublishAutoAck

        public boolean isPublishAutoAck()
        Returns:
        auto acknowledge status for publishing (in/out)
      • autoKeepAlive

        public MqttEndpoint autoKeepAlive​(boolean isAutoKeepAlive)
        Parameters:
        isAutoKeepAlive - auto keep alive
        Returns:
        a reference to this, so the API can be used fluently
      • isAutoKeepAlive

        public boolean isAutoKeepAlive()
        Returns:
        the auto keep alive status (sending ping response)
      • isConnected

        public boolean isConnected()
        Returns:
        if the connection between remote client and local endpoint is established/open
      • setClientIdentifier

        public MqttEndpoint setClientIdentifier​(String clientIdentifier)
        Parameters:
        clientIdentifier - the client identifier
        Returns:
        a reference to this, so the API can be used fluently
      • disconnectHandler

        public MqttEndpoint disconnectHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • publishAcknowledgeHandler

        public MqttEndpoint publishAcknowledgeHandler​(Consumer<Integer> handler)
        Parameters:
        handler - the handler
        Returns:
      • publishReceivedHandler

        public MqttEndpoint publishReceivedHandler​(Consumer<Integer> handler)
        Parameters:
        handler - the handler
        Returns:
      • publishReleaseHandler

        public MqttEndpoint publishReleaseHandler​(Consumer<Integer> handler)
        Parameters:
        handler - the handler
        Returns:
      • publishCompletionHandler

        public MqttEndpoint publishCompletionHandler​(Consumer<Integer> handler)
        Parameters:
        handler - the handler
        Returns:
      • pingHandler

        public MqttEndpoint pingHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • closeHandler

        public MqttEndpoint closeHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • accept

        public MqttEndpoint accept()
        Returns:
        the instance of MqttEndpoint to chain method calls.
      • accept

        public MqttEndpoint accept​(boolean sessionPresent)
        Parameters:
        sessionPresent - if a previous session is present
        Returns:
        a reference to this, so the API can be used fluently
      • reject

        public MqttEndpoint reject​(io.netty.handler.codec.mqtt.MqttConnectReturnCode returnCode)
        Parameters:
        returnCode - the connect return code
        Returns:
        a reference to this, so the API can be used fluently
      • subscribeAcknowledge

        public MqttEndpoint subscribeAcknowledge​(int subscribeMessageId,
                                                 List<io.netty.handler.codec.mqtt.MqttQoS> grantedQoSLevels)
        Parameters:
        subscribeMessageId - identifier of the SUBSCRIBE message to acknowledge
        grantedQoSLevels - granted QoS levels for the requested topics
        Returns:
        a reference to this, so the API can be used fluently
      • unsubscribeAcknowledge

        public MqttEndpoint unsubscribeAcknowledge​(int unsubscribeMessageId)
        Parameters:
        unsubscribeMessageId - identifier of the UNSUBSCRIBE message to acknowledge
        Returns:
        a reference to this, so the API can be used fluently
      • publishAcknowledge

        public MqttEndpoint publishAcknowledge​(int publishMessageId)
        Parameters:
        publishMessageId - identifier of the PUBLISH message to acknowledge
        Returns:
        a reference to this, so the API can be used fluently
      • publishReceived

        public MqttEndpoint publishReceived​(int publishMessageId)
        Parameters:
        publishMessageId - identifier of the PUBLISH message to acknowledge
        Returns:
        a reference to this, so the API can be used fluently
      • publishRelease

        public MqttEndpoint publishRelease​(int publishMessageId)
        Parameters:
        publishMessageId - identifier of the PUBLISH message to acknowledge
        Returns:
        a reference to this, so the API can be used fluently
      • publishComplete

        public MqttEndpoint publishComplete​(int publishMessageId)
        Parameters:
        publishMessageId - identifier of the PUBLISH message to acknowledge
        Returns:
        a reference to this, so the API can be used fluently
      • publish

        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 server

        Unlike 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 uni firing the result of the operation when completed, or a failure if the operation failed.
      • publishAndAwait

        public Integer publishAndAwait​(String topic,
                                       Buffer payload,
                                       io.netty.handler.codec.mqtt.MqttQoS qosLevel,
                                       boolean isDup,
                                       boolean isRetain)
        Blocking variant of publish(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.
      • publish

        public io.smallrye.mutiny.Uni<Integer> publish​(String topic,
                                                       Buffer payload,
                                                       io.netty.handler.codec.mqtt.MqttQoS qosLevel,
                                                       boolean isDup,
                                                       boolean isRetain,
                                                       int messageId)
        Sends the PUBLISH message to the remote MQTT server explicitly specifying the messageId

        Unlike 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
        messageId - message ID
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • publishAndAwait

        public Integer publishAndAwait​(String topic,
                                       Buffer payload,
                                       io.netty.handler.codec.mqtt.MqttQoS qosLevel,
                                       boolean isDup,
                                       boolean isRetain,
                                       int messageId)
        Blocking variant of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,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 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
        messageId - message ID
        Returns:
        the Integer instance produced by the operation.
      • pong

        public MqttEndpoint pong()
        Returns:
        a reference to this, so the API can be used fluently
      • newInstance

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