Class MqttEndpoint

java.lang.Object
io.vertx.mutiny.mqtt.MqttEndpoint
All Implemented Interfaces:
MutinyDelegate

public class MqttEndpoint extends Object implements MutinyDelegate
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.

  • Field Details

  • Constructor Details

    • MqttEndpoint

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

      public MqttEndpoint(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.mqtt.MqttEndpoint getDelegate()
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate used by this Mutiny object of generated type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • 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.
    • httpHeaders

      public MultiMap httpHeaders()
      Returns:
      the HTTP headers
    • httpRequestURI

      public String httpRequestURI()
      Returns:
      the HTTP request uri
    • 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:
    • disconnectMessageHandler

      public MqttEndpoint disconnectMessageHandler(Consumer<MqttDisconnectMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • subscribeHandler

      public MqttEndpoint subscribeHandler(Consumer<MqttSubscribeMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • unsubscribeHandler

      public MqttEndpoint unsubscribeHandler(Consumer<MqttUnsubscribeMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • publishHandler

      public MqttEndpoint publishHandler(Consumer<MqttPublishMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • publishAcknowledgeHandler

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

      public MqttEndpoint publishAcknowledgeMessageHandler(Consumer<MqttPubAckMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • publishReceivedHandler

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

      public MqttEndpoint publishReceivedMessageHandler(Consumer<MqttPubRecMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • publishReleaseHandler

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

      public MqttEndpoint publishReleaseMessageHandler(Consumer<MqttPubRelMessage> handler)
      Parameters:
      handler - the handler
      Returns:
    • publishCompletionHandler

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

      public MqttEndpoint publishCompletionMessageHandler(Consumer<MqttPubCompMessage> 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:
    • exceptionHandler

      public MqttEndpoint exceptionHandler(Consumer<Throwable> 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

      @CheckReturnValue 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.
    • publishAndForget

      public MqttEndpoint publishAndForget(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)
      Variant of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean) that ignores the result of the operation.

      This method subscribes on the result of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean) but you don't need to compose it with other operations.

      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 instance of MqttEndpoint to chain method calls.
    • publish

      @CheckReturnValue 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.
    • publishAndForget

      public MqttEndpoint publishAndForget(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain, int messageId)
      Variant of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int) that ignores the result of the operation.

      This method subscribes on the result of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int) but you don't need to compose it with other operations.

      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 instance of MqttEndpoint to chain method calls.
    • pong

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

      public io.netty.handler.codec.mqtt.MqttProperties connectProperties()
      Returns:
      MQTT properties of the CONNECT message
    • accept

      public MqttEndpoint accept(boolean sessionPresent, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      sessionPresent - if a previous session is present
      properties - CONNACK message properties (MQTT5)
      Returns:
      a reference to this, so the API can be used fluently
    • reject

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

      public MqttEndpoint subscribeAcknowledge(int subscribeMessageId, List<io.vertx.mqtt.messages.codes.MqttSubAckReasonCode> reasonCodes, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      subscribeMessageId - identifier of the SUBSCRIBE message to acknowledge
      reasonCodes - reason codes
      properties - MQTT message properties
      Returns:
      a reference to this, so the API can be used fluently
    • unsubscribeAcknowledge

      public MqttEndpoint unsubscribeAcknowledge(int unsubscribeMessageId, List<io.vertx.mqtt.messages.codes.MqttUnsubAckReasonCode> reasonCodes, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      unsubscribeMessageId - identifier of the UNSUBSCRIBE message to acknowledge
      reasonCodes - reason codes
      properties - MQTT message properties
      Returns:
      a reference to this, so the API can be used fluently
    • publishAcknowledge

      public MqttEndpoint publishAcknowledge(int publishMessageId, io.vertx.mqtt.messages.codes.MqttPubAckReasonCode reasonCode, io.netty.handler.codec.mqtt.MqttProperties properties)
    • publishReceived

      public MqttEndpoint publishReceived(int publishMessageId, io.vertx.mqtt.messages.codes.MqttPubRecReasonCode reasonCode, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      publishMessageId - identifier of the PUBLISH message to acknowledge
      reasonCode - code of the outcome
      properties - MQTT properties
      Returns:
      a reference to this, so the API can be used fluently
    • publishRelease

      public MqttEndpoint publishRelease(int publishMessageId, io.vertx.mqtt.messages.codes.MqttPubRelReasonCode reasonCode, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      publishMessageId - identifier of the PUBLISH message to acknowledge
      reasonCode - reason code
      properties - MQTT message properties
      Returns:
      a reference to this, so the API can be used fluently
    • publishComplete

      public MqttEndpoint publishComplete(int publishMessageId, io.vertx.mqtt.messages.codes.MqttPubCompReasonCode reasonCode, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      publishMessageId - identifier of the PUBLISH message to acknowledge
      reasonCode - reason code
      properties - MQTT message properties
      Returns:
      a reference to this, so the API can be used fluently
    • publish

      @CheckReturnValue public io.smallrye.mutiny.Uni<Integer> publish(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain, int messageId, io.netty.handler.codec.mqtt.MqttProperties properties)
      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
      properties - PUBLISH message properties
      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, io.netty.handler.codec.mqtt.MqttProperties properties)
      Blocking variant of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int,MqttProperties).

      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
      properties - PUBLISH message properties
      Returns:
      the Integer instance produced by the operation.
    • publishAndForget

      public MqttEndpoint publishAndForget(String topic, Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain, int messageId, io.netty.handler.codec.mqtt.MqttProperties properties)
      Variant of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int,MqttProperties) that ignores the result of the operation.

      This method subscribes on the result of publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int,MqttProperties), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from publish(String,io.vertx.mutiny.core.buffer.Buffer,MqttQoS,boolean,boolean,int,MqttProperties) but you don't need to compose it with other operations.

      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
      properties - PUBLISH message properties
      Returns:
      the instance of MqttEndpoint to chain method calls.
    • disconnect

      public MqttEndpoint disconnect(io.vertx.mqtt.messages.codes.MqttDisconnectReasonCode code, io.netty.handler.codec.mqtt.MqttProperties properties)
      Parameters:
      code - reason code
      properties - MQTT message properties
      Returns:
      a reference to this, so the API can be used fluently
    • newInstance

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