Module: Sneakers::Worker::ClassMethods
- Defined in:
- lib/sneakers/worker.rb
Instance Attribute Summary collapse
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
-
#queue_opts ⇒ Object
readonly
Returns the value of attribute queue_opts.
Instance Method Summary collapse
Instance Attribute Details
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
135 136 137 |
# File 'lib/sneakers/worker.rb', line 135 def queue_name @queue_name end |
#queue_opts ⇒ Object (readonly)
Returns the value of attribute queue_opts.
134 135 136 |
# File 'lib/sneakers/worker.rb', line 134 def queue_opts @queue_opts end |
Instance Method Details
#enqueue(msg, opts = {}) ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/sneakers/worker.rb', line 142 def enqueue(msg, opts={}) opts[:routing_key] ||= @queue_opts[:routing_key] opts[:content_type] ||= @queue_opts[:content_type] opts[:to_queue] ||= @queue_name publisher.publish(msg, opts) end |
#from_queue(q, opts = {}) ⇒ Object
137 138 139 140 |
# File 'lib/sneakers/worker.rb', line 137 def from_queue(q, opts={}) @queue_name = q.to_s @queue_opts = opts end |