class Ruote::Synchronize::Participant
A special kind of participant registered as “synchronize”
Public Instance Methods
on_cancel()
click to toggle source
Deletes the synchronization key from storage if it still exists. @return [void]
# File lib/ruote/synchronize/participant.rb, line 36 def on_cancel key = applied_workitem.lookup('params.key') broker.unpublish(key) end
on_workitem()
click to toggle source
Replies if another synchronize call was made previously with the same key. Otherwise stores the workitem and does not reply. @raise [UndefinedKey] if synchronize was called with a nil or empty key. @return [void]
# File lib/ruote/synchronize/participant.rb, line 25 def on_workitem key = workitem.lookup('params.key') raise UndefinedKey if key.to_s.empty? reply if broker.publish(key, workitem) end
Private Instance Methods
broker()
click to toggle source
# File lib/ruote/synchronize/participant.rb, line 45 def broker @broker ||= Ruote::Synchronize::Broker.new(self.context) end