Enum Class AckMode

java.lang.Object
java.lang.Enum<AckMode>
org.mqtt4j.hato.AckMode
All Implemented Interfaces:
Serializable, Comparable<AckMode>, Constable

public enum AckMode extends Enum<AckMode>

When a subscription makes a QoS 1 or QoS 2 delivery eligible for acknowledgement. QoS 0 deliveries need none.

PUBACK (QoS 1) or PUBREC (QoS 2) waits until every subscription that received the message meets its condition. PUBACK and PUBREC follow one receive-order sequence. A delivery that has not met its condition therefore holds back the acknowledgements of every later QoS 1 and QoS 2 message on the connection, including other subscriptions' messages. PUBCOMP does not wait for such a delivery. Push subscriptions keep a delivery's capacity until its handler finishes and, for QoS 1 and 2, its acknowledgement has its turn. Pull subscriptions release it at handoff (ON_RECEIVE) or at MqttDelivery.ack() (MANUAL), and hand-off subscriptions when their acceptor accepts the delivery, in either mode. The client also limits the receptions that may await protocol completion in one session, including QoS 2 exchanges and connections that continue the session; ClientStats.Receiving.receptions() shows the limit. A QoS 1 or 2 message that exhausts either bound ends the connection; see Subscribe.bufferCapacity(). Connection loss alone does not release a push delivery's capacity in a continued session. Acknowledgement never releases a running handler's capacity.

  • Enum Constant Details

    • ON_RECEIVE

      public static final AckMode ON_RECEIVE
      Immediately before invoking the handler, when a pull receive hands off the delivery, or when a hand-off subscription's acceptor accepts it. The default for pull and hand-off subscriptions. Does not wait for application processing, and a handler failure does not withdraw it; see FailurePolicy.
    • AFTER_HANDLER

      public static final AckMode AFTER_HANDLER
      After the handler returns normally. The default for a subscription with a handler; rejected for pull and hand-off subscriptions.
    • MANUAL

      public static final AckMode MANUAL
      When the application calls MqttDelivery.ack(). Call it for every delivery; it has no effect where no acknowledgement is needed. A subscription that requested QoS 0 still receives QoS 1 or 2 messages that also match another subscription, so MqttMessage.qos() can exceed Subscription.grantedQos().
  • Method Details

    • values

      public static AckMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AckMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null