Class: Ruote::Synchronize::Participant
- Inherits:
-
Object
- Object
- Ruote::Synchronize::Participant
- Includes:
- LocalParticipant
- Defined in:
- lib/ruote/synchronize/participant.rb
Overview
A special kind of participant registered as "synchronize"
Instance Method Summary collapse
-
#on_cancel ⇒ void
Deletes the synchronization key from storage if it still exists.
-
#on_workitem ⇒ void
Replies if another synchronize call was made previously with the same key.
Instance Method Details
#on_cancel ⇒ void
This method returns an undefined value.
Deletes the synchronization key from storage if it still exists.
36 37 38 39 40 41 |
# File 'lib/ruote/synchronize/participant.rb', line 36 def on_cancel key = applied_workitem.lookup('params.key') broker.unpublish(key) end |
#on_workitem ⇒ void
This method returns an undefined value.
Replies if another synchronize call was made previously with the same key. Otherwise stores the workitem and does not reply.
25 26 27 28 29 30 31 32 |
# 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 |