Class: Eventboss::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/eventboss/fetcher.rb

Constant Summary collapse

FETCH_LIMIT =

maximum possible for SQS

10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Fetcher

Returns a new instance of Fetcher.



7
8
9
# File 'lib/eventboss/fetcher.rb', line 7

def initialize(configuration)
  @client = configuration.sqs_client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/eventboss/fetcher.rb', line 5

def client
  @client
end

Instance Method Details

#delete(queue, message) ⇒ Object



15
16
17
# File 'lib/eventboss/fetcher.rb', line 15

def delete(queue, message)
  @client.delete_message(queue_url: queue.url, receipt_handle: message.receipt_handle)
end

#fetch(queue, limit) ⇒ Object



11
12
13
# File 'lib/eventboss/fetcher.rb', line 11

def fetch(queue, limit)
  @client.receive_message(queue_url: queue.url, max_number_of_messages: max_no_of_messages(limit)).messages
end