Enum Class FailurePolicy
- All Implemented Interfaces:
Serializable, Comparable<FailurePolicy>, Constable
What a push subscription does when its handler throws for a delivery, and a hand-off
subscription when its acceptor throws. Set it with
Subscribe.withFailurePolicy(FailurePolicy); pull subscriptions have no handler and accept
only STOP.
Either policy applies only to exceptions that escape the handler or the acceptor. To retry a
transient failure, catch it and repeat the work inside the handler, which keeps the
subscription's order and holds back the acknowledgement meanwhile. A skipped failure is
logged, and ClientStats.Receiving.dropped() counts it as
ClientStats.DropReason.FAILED.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSkips every failed delivery: a QoS 1 or 2 delivery is acknowledged without processing, and a QoS 0 delivery is dropped.Stops the client when the failed delivery still holds back its acknowledgement: a QoS 1 or 2 delivery withAckMode.AFTER_HANDLER, or withAckMode.MANUALbeforeMqttDelivery.ack(). -
Method Summary
Modifier and TypeMethodDescriptionstatic FailurePolicyReturns the enum constant of this class with the specified name.static FailurePolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STOP
Stops the client when the failed delivery still holds back its acknowledgement: a QoS 1 or 2 delivery withAckMode.AFTER_HANDLER, or withAckMode.MANUALbeforeMqttDelivery.ack(). The failure ends the connection and withdraws the connection request, asMqttSubscriber.subscribe(Subscribe, java.util.function.Consumer)describes, so the unacknowledged message can come back in a continued session instead of being lost silently. A failed delivery that holds back no acknowledgement (QoS 0,AckMode.ON_RECEIVE, or MANUAL after ack()) has nothing to protect, so it is skipped asSKIPskips it. The default. -
SKIP
Skips every failed delivery: a QoS 1 or 2 delivery is acknowledged without processing, and a QoS 0 delivery is dropped. The subscription and the connection continue, and a message that matched other subscriptions still reaches them. Use it when the handler's failures are deterministic, so a redelivery would fail again.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-