Class: Magent::ActorChannel
- Inherits:
-
GenericChannel
- Object
- GenericChannel
- Magent::ActorChannel
- Defined in:
- lib/magent/actor_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
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
#on_shutdown ⇒ Object
28 29 30 31 32 |
# File 'lib/magent/actor_channel.rb', line 28 def on_shutdown if @method self.enqueue(@method, @payload) end end |
#process!(message) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/magent/actor_channel.rb', line 7 def process!() @actor = Magent.current_actor @method, @payload = return false if @method.nil? sucess = @actor._run_tasks $stderr.puts "#{@actor.class}##{@method}(#{@payload.inspect})" if @actor.class.can_handle?(@method) @actor.send(@method, @payload) return true else $stderr.puts "Unknown action: #{@method} (payload=#{@payload.inspect})" end @method, @payload = nil sucess end |
#push(message, args) ⇒ Object
3 4 5 |
# File 'lib/magent/actor_channel.rb', line 3 def push(, args) enqueue([, args]) end |