Class: TxghQueue::Backends::Sqs::Producer
- Inherits:
-
Object
- Object
- TxghQueue::Backends::Sqs::Producer
- Defined in:
- lib/txgh-queue/backends/sqs/producer.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#queues ⇒ Object
readonly
Returns the value of attribute queues.
Instance Method Summary collapse
- #enqueue(payload, options = {}) ⇒ Object
-
#initialize(queues, logger) ⇒ Producer
constructor
A new instance of Producer.
Constructor Details
#initialize(queues, logger) ⇒ Producer
Returns a new instance of Producer.
9 10 11 12 |
# File 'lib/txgh-queue/backends/sqs/producer.rb', line 9 def initialize(queues, logger) @queues = queues @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/txgh-queue/backends/sqs/producer.rb', line 7 def logger @logger end |
#queues ⇒ Object (readonly)
Returns the value of attribute queues.
7 8 9 |
# File 'lib/txgh-queue/backends/sqs/producer.rb', line 7 def queues @queues end |
Instance Method Details
#enqueue(payload, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/txgh-queue/backends/sqs/producer.rb', line 14 def enqueue(payload, = {}) payload_json = payload.to_json = queues.map do |queue| = queue.(payload_json, ) logger.info( "Enqueued new message with id #{.} and params "\ "#{payload_json}" ) . end { message_ids: } end |