Module: Cuniculus::Worker::ClassMethods
- Defined in:
- lib/cuniculus/worker.rb
Instance Method Summary collapse
Instance Method Details
#normalize_item(item) ⇒ Object
25 26 27 |
# File 'lib/cuniculus/worker.rb', line 25 def normalize_item(item) Cuniculus.dump_job(item) end |
#perform_async(*args) ⇒ Object
13 14 15 |
# File 'lib/cuniculus/worker.rb', line 13 def perform_async(*args) publish({ "class" => self, "args" => args }) end |
#publish(item) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cuniculus/worker.rb', line 17 def publish(item) routing_key = "cun_default" payload = normalize_item(item) Cuniculus::RMQPool.with_exchange do |x| x.publish(payload, { routing_key: routing_key, persistent: true }) end end |