Method: Aws::SQS::QueuePoller#initialize
- Defined in:
- lib/aws-sdk-sqs/queue_poller.rb
#initialize(queue_url, options = {}) ⇒ QueuePoller
Returns a new instance of QueuePoller.
Parameters:
- queue_url (String)
-
options
(Hash)
(defaults to: {})
—
a customizable set of options
Options Hash (options):
- :client (Client)
-
:wait_time_seconds
(Integer)
— default:
20
—
The long polling interval. Messages are yielded as soon as they are received. The
:wait_time_secondsoption specifies the max duration for each polling attempt before a new request is sent to receive messages. -
:max_number_of_messages
(Integer)
— default:
1
—
The maximum number of messages to yield from each polling attempt. Values can be from 1 to 10.
-
:visibility_timeout
(Integer)
— default:
nil
—
The number of seconds you have to process a message before it is put back into the queue and can be received again. By default, the queue’s visibility timeout is not set.
-
:attribute_names
(Array<String>)
— default:
[]
—
The list of attributes that need to be returned along with each message. Valid attribute names include:
-
All- All attributes. -
ApproximateFirstReceiveTimestamp- The time when the messagewas first received from the queue (epoch time in milliseconds). -
ApproximateReceiveCount- The number of times a message hasbeen received from the queue but not deleted. -
SenderId- The AWS account number (or the IP address, ifanonymous access is allowed) of the sender. -
SentTimestamp- The time when the message was sent to thequeue (epoch time in milliseconds).
-
-
:message_attribute_names
(Array<String>)
— default:
[]
—
A list of message attributes to receive. You can receive all messages by using
Allor.*. You can also usefoo.*to return all message attributes starting with thefooprefix. -
:idle_timeout
(Integer)
— default:
nil
—
Polling terminates gracefully when
:idle_timeoutseconds have passed without receiving any messages. -
:skip_delete
(Boolean)
— default:
false
—
When
true, messages are not deleted after polling block. If you wish to delete received messages, you will need to call#delete_messageor#delete_messagesmanually. -
:before_request
(Proc)
— default:
nil
—
Called before each polling attempt. This proc receives a single argument, an instance of PollerStats.
218 219 220 221 222 |
# File 'lib/aws-sdk-sqs/queue_poller.rb', line 218 def initialize(queue_url, options = {}) @queue_url = queue_url @client = options.delete(:client) || Client.new @default_config = PollerConfig.new(options) end |