Class: Magent::AsyncChannel
- Inherits:
-
GenericChannel
- Object
- GenericChannel
- Magent::AsyncChannel
- Defined in:
- lib/magent/async_channel.rb
Instance Attribute Summary
Attributes inherited from GenericChannel
Instance Method Summary collapse
Methods inherited from GenericChannel
#collection, #dequeue, #enqueue, #initialize, #message_count, #next_message, #queue_count, #retry_current_job
Methods included from Stats
#on_job_failed, #on_job_processed, #on_quit, #on_start, #stats, #stats_collection
Methods included from Failure
#enqueue_error, #error_collection, #error_count, #errors, #failed, #remove_error, #retry_error
Constructor Details
This class inherits a constructor from Magent::GenericChannel
Instance Method Details
#process!(message) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/magent/async_channel.rb', line 15 def process!() klass, id, method = return false if method.nil? target = async_find(klass, id) args = resolve_args(method[1]) target = target.send(method[0], *args) true end |
#push(target, method, priority) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/magent/async_channel.rb', line 3 def push(target, method, priority) encode_args(method[1]) if target.kind_of?(Class) enqueue([target.to_s, nil, method], priority) elsif target.class.respond_to?(:find) && target.respond_to?(:id) enqueue([target.class.to_s, target.id, method], priority) else raise ArgumentError, "I don't know how to handle #{target.inspect}" end end |