Class: Chore::Queues::SQS::Publisher
- Defined in:
- lib/chore/queues/sqs/publisher.rb
Overview
SQS Publisher, for writing messages to SQS from Chore
Constant Summary collapse
- @@reset_next =
true
Constants inherited from Publisher
Instance Attribute Summary
Attributes inherited from Publisher
Class Method Summary collapse
-
.reset_connection! ⇒ Object
Sets a flag that instructs the publisher to reset the connection the next time it's used.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Publisher
constructor
A new instance of Publisher.
-
#publish(queue_name, job) ⇒ struct Aws::SQS::Types::SendMessageResult
Publishes a message to an SQS queue.
Methods inherited from Publisher
Constructor Details
#initialize(opts = {}) ⇒ Publisher
Returns a new instance of Publisher.
11 12 13 14 15 |
# File 'lib/chore/queues/sqs/publisher.rb', line 11 def initialize(opts={}) super @sqs_queues = {} @sqs_queue_urls = {} end |
Class Method Details
.reset_connection! ⇒ Object
Sets a flag that instructs the publisher to reset the connection the next time it's used
29 30 31 |
# File 'lib/chore/queues/sqs/publisher.rb', line 29 def self.reset_connection! @@reset_next = true end |
Instance Method Details
#publish(queue_name, job) ⇒ struct Aws::SQS::Types::SendMessageResult
Publishes a message to an SQS queue
23 24 25 26 |
# File 'lib/chore/queues/sqs/publisher.rb', line 23 def publish(queue_name,job) queue = queue(queue_name) queue.(message_body: encode_job(job)) end |