Class: Google::Cloud::PubSub::RetryPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/pubsub/retry_policy.rb

Overview

RetryPolicy

An immutable Retry Policy value object that specifies how Cloud Pub/Sub retries message delivery.

Retry delay will be exponential based on provided minimum and maximum backoffs. (See Exponential backoff.)

Retry Policy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message.

Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff.

Examples:

require "google/cloud/pubsub"

pubsub = Google::Cloud::PubSub.new

sub = pubsub.subscription "my-topic-sub"

sub.retry_policy = Google::Cloud::PubSub::RetryPolicy.new minimum_backoff: 5, maximum_backoff: 300

sub.retry_policy.minimum_backoff #=> 5
sub.retry_policy.maximum_backoff #=> 300

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(minimum_backoff: nil, maximum_backoff: nil) ⇒ RetryPolicy

Creates a new, immutable RetryPolicy value object.



63
64
65
66
# File 'lib/google/cloud/pubsub/retry_policy.rb', line 63

def initialize minimum_backoff: nil, maximum_backoff: nil
  @minimum_backoff = minimum_backoff
  @maximum_backoff = maximum_backoff
end

Instance Attribute Details

#maximum_backoffNumeric

The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. The default value is 600 seconds.

Returns:

  • (Numeric)

    the current value of maximum_backoff



51
52
53
# File 'lib/google/cloud/pubsub/retry_policy.rb', line 51

def maximum_backoff
  @maximum_backoff
end

#minimum_backoffNumeric

The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. The default value is 10 seconds.

Returns:

  • (Numeric)

    the current value of minimum_backoff



51
52
53
# File 'lib/google/cloud/pubsub/retry_policy.rb', line 51

def minimum_backoff
  @minimum_backoff
end