Sha256: 9de602102385c5d5a1e1ba5817cb28c0a91c0c1e9568cbac2d605c6096112914

Contents?: true

Size: 870 Bytes

Versions: 27

Compression:

Stored size: 870 Bytes

Contents

require 'yaml'
require 'shoryuken'

# load SQS credentials
config = YAML.load File.read(File.join(File.expand_path(__dir__), 'shoryuken.yml'))

Aws.config = config['aws']

sqs = Aws::SQS::Client.new

default_queue_url = sqs.create_queue(queue_name: 'default').queue_url

if sqs.config['endpoint'] =~ /amazonaws.com/
  # create a dead letter queue
  # after 7 attempts SQS will move the message to the dead letter queue

  dead_letter_queue_url = sqs.create_queue(queue_name: 'default_failures').queue_url

  dead_letter_queue_arn = sqs.get_queue_attributes(
    queue_url: dead_letter_queue_url,
    attribute_names: %w[QueueArn]
  ).attributes['QueueArn']

  attributes = {}
  attributes['RedrivePolicy'] = %({"maxReceiveCount":"7", "deadLetterTargetArn":"#{dead_letter_queue_arn}"})

  sqs.set_queue_attributes queue_url: default_queue_url, attributes: attributes
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
shoryuken-6.2.1 examples/bootstrap_queues.rb
shoryuken-6.2.0 examples/bootstrap_queues.rb
shoryuken-6.1.1 examples/bootstrap_queues.rb
shoryuken-6.1.0 examples/bootstrap_queues.rb
shoryuken-6.0.0 examples/bootstrap_queues.rb
shoryuken-5.3.2 examples/bootstrap_queues.rb
shoryuken-5.3.1 examples/bootstrap_queues.rb
shoryuken-5.3.0 examples/bootstrap_queues.rb
shoryuken-5.2.3 examples/bootstrap_queues.rb
shoryuken-5.2.2 examples/bootstrap_queues.rb
shoryuken-5.2.1 examples/bootstrap_queues.rb
shoryuken-5.2.0 examples/bootstrap_queues.rb
shoryuken-5.1.1 examples/bootstrap_queues.rb
shoryuken-5.1.0 examples/bootstrap_queues.rb
shoryuken-5.0.6 examples/bootstrap_queues.rb
shoryuken-5.0.5 examples/bootstrap_queues.rb
shoryuken-5.0.4 examples/bootstrap_queues.rb
shoryuken-5.0.3 examples/bootstrap_queues.rb
shoryuken-5.0.2 examples/bootstrap_queues.rb
shoryuken-5.0.1 examples/bootstrap_queues.rb