Class: Lambdakiq::Queue
- Inherits:
-
Object
- Object
- Lambdakiq::Queue
- Defined in:
- lib/lambdakiq/queue.rb
Instance Attribute Summary collapse
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
-
#queue_url ⇒ Object
readonly
Returns the value of attribute queue_url.
Instance Method Summary collapse
- #attributes ⇒ Object
- #fifo? ⇒ Boolean
-
#initialize(queue_name) ⇒ Queue
constructor
A new instance of Queue.
- #max_receive_count ⇒ Object
- #redrive_policy ⇒ Object
- #send_message(job, options = {}) ⇒ Object
Constructor Details
#initialize(queue_name) ⇒ Queue
Returns a new instance of Queue.
7 8 9 10 11 |
# File 'lib/lambdakiq/queue.rb', line 7 def initialize(queue_name) @queue_name = queue_name @queue_url = get_queue_url attributes end |
Instance Attribute Details
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
4 5 6 |
# File 'lib/lambdakiq/queue.rb', line 4 def queue_name @queue_name end |
#queue_url ⇒ Object (readonly)
Returns the value of attribute queue_url.
4 5 6 |
# File 'lib/lambdakiq/queue.rb', line 4 def queue_url @queue_url end |
Instance Method Details
#attributes ⇒ Object
17 18 19 20 21 22 |
# File 'lib/lambdakiq/queue.rb', line 17 def attributes @attributes ||= client.get_queue_attributes({ queue_url: queue_url, attribute_names: ['All'] }).attributes end |
#fifo? ⇒ Boolean
32 33 34 |
# File 'lib/lambdakiq/queue.rb', line 32 def fifo? queue_name.ends_with?('.fifo') end |
#max_receive_count ⇒ Object
28 29 30 |
# File 'lib/lambdakiq/queue.rb', line 28 def max_receive_count redrive_policy&.dig('maxReceiveCount')&.to_i || 1 end |
#redrive_policy ⇒ Object
24 25 26 |
# File 'lib/lambdakiq/queue.rb', line 24 def redrive_policy @redrive_policy ||= attributes['RedrivePolicy'] ? JSON.parse(attributes['RedrivePolicy']) : nil end |
#send_message(job, options = {}) ⇒ Object
13 14 15 |
# File 'lib/lambdakiq/queue.rb', line 13 def (job, = {}) client. (job, ) end |