Class: Ruote::DispatchPool

Inherits:
Object
  • Object
show all
Defined in:
lib/ruote/svc/dispatch_pool.rb

Overview

The class where despatchement of workitems towards [real] participant is done.

Can be extended/replaced for better handling of Thread (why not something like a thread pool or no threads at all).

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ DispatchPool

Returns a new instance of DispatchPool.



37
38
39
40
# File 'lib/ruote/svc/dispatch_pool.rb', line 37

def initialize(context)

  @context = context
end

Instance Method Details

#handle(msg) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/ruote/svc/dispatch_pool.rb', line 42

def handle(msg)

  case msg['action']
    when 'dispatch' then dispatch(msg)
    when 'dispatch_cancel' then dispatch_cancel(msg)
    when 'dispatch_pause', 'dispatch_resume' then dispatch_pause(msg)
    else # simply discard the message
  end
end