Class: WindUp::ForwardedCall

Inherits:
Celluloid::Call
  • Object
show all
Defined in:
lib/wind_up/calls.rb

Overview

WindUp’s ForwardedCall tells an actor to pull a message from a source mailbox when processed

Constant Summary collapse

TIMEOUT =

Do not block if no work found

0

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ForwardedCall

Returns a new instance of ForwardedCall.



9
10
11
# File 'lib/wind_up/calls.rb', line 9

def initialize(source)
  @source = source
end

Instance Method Details

#dispatch(obj) ⇒ Object

Pull the next message from the source, if available



14
15
16
17
# File 'lib/wind_up/calls.rb', line 14

def dispatch(obj)
  msg = @source.receive(TIMEOUT)
  ::Celluloid.mailbox << msg if msg
end