lib/pheme/queue_poller.rb in pheme-0.0.2 vs lib/pheme/queue_poller.rb in pheme-0.0.3

- old
+ new

@@ -1,18 +1,18 @@ module Pheme class QueuePoller attr_accessor :queue_url, :queue_poller, :connection_pool_block, :poller_configuration def initialize(queue_url:, connection_pool_block: false, poller_configuration: {}) + raise ArgumentError, "must specify non-nil queue_url" unless queue_url.present? @queue_url = queue_url @queue_poller = Aws::SQS::QueuePoller.new(queue_url) @connection_pool_block = connection_pool_block - @poller_configuration = poller_configuration.merge({ + @poller_configuration = { wait_time_seconds: 10, # amount of time a long polling receive call can wait for a mesage before receiving a empty response (which will trigger another polling request) idle_timeout: 20, # disconnects poller after 20 seconds of idle time - visibility_timeout: 30, # length of time in seconds that this message will not be visible to other receiving components skip_delete: true, # manually delete messages - }) + }.merge(poller_configuration || {}) end def poll Pheme.log(:info, "Long-polling for messages on #{queue_url}") with_optional_connection_pool_block do