Class: Aws::SQS::QueuePoller::PollerConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-sqs/queue_poller.rb

Overview

A read-only set of configuration used by the QueuePoller.

Constant Summary collapse

CONFIG_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new([
  :idle_timeout,
  :skip_delete,
  :before_request,
])
PARAM_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Set.new([
  :wait_time_seconds,
  :max_number_of_messages,
  :visibility_timeout,
  :attribute_names,
  :message_attribute_names,
])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ PollerConfig

Returns a new instance of PollerConfig.



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 481

def initialize(options)
  @idle_timeout = nil
  @skip_delete = false
  @before_request = nil
  @request_params = {
    wait_time_seconds: 20,
    max_number_of_messages: 1,
    visibility_timeout: nil,
    attribute_names: ['All'],
    message_attribute_names: ['All'],
  }
  options.each do |opt_name, value|
    if CONFIG_OPTIONS.include?(opt_name)
      instance_variable_set("@#{opt_name}", value)
    elsif PARAM_OPTIONS.include?(opt_name)
      @request_params[opt_name] = value
    else
      raise ArgumentError, "invalid option #{opt_name.inspect}"
    end
  end

  max_number_of_messages = @request_params[:max_number_of_messages]
  unless max_number_of_messages.is_a?(Integer) && max_number_of_messages.positive?
    raise ArgumentError, ':max_number_of_messages must be a positive integer'
  end

  @request_params.freeze
  freeze
end

Instance Attribute Details

#before_requestProc? (readonly)

Returns:

  • (Proc, nil)


476
477
478
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 476

def before_request
  @before_request
end

#idle_timeoutInteger? (readonly)

Returns:

  • (Integer, nil)


470
471
472
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 470

def idle_timeout
  @idle_timeout
end

#request_paramsHash (readonly)

Returns:

  • (Hash)


479
480
481
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 479

def request_params
  @request_params
end

#skip_deleteBoolean (readonly)

Returns:

  • (Boolean)


473
474
475
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 473

def skip_delete
  @skip_delete
end

Instance Method Details

#with(options) ⇒ PollerConfig

Returns a new Aws::SQS::QueuePoller::PollerConfig instance with the given options applied.

Returns:



513
514
515
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 513

def with(options)
  self.class.new(to_h.merge(options))
end