enum

NATS::JetStream::NAKBackoff

Inherits Enum / Comparable / Value / Object

Common nack backoff strategies give a simple shorthand for setting the delays on subsequent delivery attempts.

nats = NATS::Client.new

jetstream.subscribe consumer do |msg|
  # do some work
  jetstream.ack msg
rescue ex
  jetstream.nack msg, backoff: :exponential
  raise ex
end

Constants

Exponential = 0

Exponential backoff starts at a delay of 1/16th of a second and doubles every time the message is nacked with this strategy. This has the effect of running the first 3 attempts roughly immediately so that an uncommon but not unexpected failure (API call in a downstream service returns a 500) doesn't need to wait several seconds unless it truly needs to.

Linear = 1

Linear backoff delays for 1 second for each time the message is nacked with this strategy.

Instance methods

exponential?

Returns true if this enum value equals Exponential

Source
linear?

Returns true if this enum value equals Linear

Source