Class MqttSubscriptionRefusedException

All Implemented Interfaces:
Serializable

public final class MqttSubscriptionRefusedException extends MqttException
The broker refused a subscription, or would refuse it. A refusal arrives in SUBACK with a reason code of 0x80 or greater; the MQTT 3.1.1 failure (0x80) is represented by ReasonCode.UNSPECIFIED_ERROR. A subscription that the broker announced it does not support is not sent and fails with the reason code that the broker would use: ReasonCode.WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED without ConnAck.wildcardSubscriptionAvailable(), and ReasonCode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED without ConnAck.sharedSubscriptionAvailable(), and ReasonCode.PACKET_TOO_LARGE when its SUBSCRIBE would be larger than ConnAck.maximumPacketSize(). Either way the failed subscription is removed locally, and the connection goes on.
See Also:
  • Constructor Details

    • MqttSubscriptionRefusedException

      public MqttSubscriptionRefusedException(ReasonCode reasonCode)
      A refusal without an explanation, such as the one that the client makes itself.
      Parameters:
      reasonCode - the reason for the refusal
    • MqttSubscriptionRefusedException

      public MqttSubscriptionRefusedException(ReasonCode reasonCode, @Nullable String reasonString)
      A refusal with the broker's explanation, if the broker sent one.
      Parameters:
      reasonCode - the reason for the refusal
      reasonString - the broker's explanation, or null when it sent none
  • Method Details

    • reasonCode

      public ReasonCode reasonCode()
      Returns the reason for the refusal, received in SUBACK, or the one that the broker would use for a subscription that it announced it does not support.
      Returns:
      the reason for the refusal, received in SUBACK, or the one that the broker would use for a subscription that it announced it does not support
    • reasonString

      public Optional<String> reasonString()
      Returns the broker's explanation for people diagnosing the refusal, received in SUBACK, or empty when the broker sent none or the client refused without sending.
      Returns:
      the broker's explanation for people diagnosing the refusal, received in SUBACK, or empty when the broker sent none or the client refused without sending