Skip to content

Commit

Permalink
Add a callback to the outcall that will get called when each evocatio…
Browse files Browse the repository at this point in the history
…n is theoretically ready.
  • Loading branch information
Samuel Tesla committed May 26, 2009
1 parent d2f97d8 commit 289dae9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/pelvis/evocation.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Evocation
include Logging include Logging
extend Callbacks extend Callbacks


callbacks :received, :completed, :failed callbacks :received, :completed, :failed, :begun


def initialize(outcall, identity) def initialize(outcall, identity)
@outcall, @identity = outcall, identity @outcall, @identity = outcall, identity
Expand Down Expand Up @@ -44,6 +44,7 @@ def start
def reply def reply
if @initialized && @begun if @initialized && @begun
@incall.begin @incall.begin
begun
end end
end end


Expand Down
6 changes: 5 additions & 1 deletion lib/pelvis/outcall.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Outcall
include Logging include Logging
extend Callbacks extend Callbacks


callbacks :received, :completed, :failed callbacks :received, :completed, :failed, :evoked


def initialize(agent, job) def initialize(agent, job)
@agent, @job = agent, job @agent, @job = agent, job
Expand Down Expand Up @@ -62,6 +62,10 @@ def evoke_to(identities)
def evoke(identity) def evoke(identity)
e = Evocation.start(self, identity) e = Evocation.start(self, identity)
evocations[e] = false evocations[e] = false
e.on_begun do
logger.debug "outcall begun: #{identity}"
evoked
end
e.on_received do |data| e.on_received do |data|
logger.debug "outcall received: #{identity}: #{data.inspect}" logger.debug "outcall received: #{identity}: #{data.inspect}"
received(data) received(data)
Expand Down

0 comments on commit 289dae9

Please sign in to comment.