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 %i[
  idle_timeout
  skip_delete
  before_request
  after_empty_receive
]
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 %i[
  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.



511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 511

def initialize(options)
  @idle_timeout = nil
  @skip_delete = false
  @before_request = nil
  @after_empty_receive = 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

#after_empty_receiveProc? (readonly)

Returns:

  • (Proc, nil)


506
507
508
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 506

def after_empty_receive
  @after_empty_receive
end

#before_requestProc? (readonly)

Returns:

  • (Proc, nil)


503
504
505
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 503

def before_request
  @before_request
end

#idle_timeoutInteger? (readonly)

Returns:

  • (Integer, nil)


497
498
499
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 497

def idle_timeout
  @idle_timeout
end

#request_paramsHash (readonly)

Returns:

  • (Hash)


509
510
511
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 509

def request_params
  @request_params
end

#skip_deleteBoolean (readonly)

Returns:

  • (Boolean)


500
501
502
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 500

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:



544
545
546
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 544

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