Guest User

Untitled

a guest
Oct 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2. require 'ruote'
  3.  
  4. $dboard = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::HashStorage.new))
  5. $dboard.noisy = true
  6.  
  7. class Observer
  8. def on_msg(msg)
  9. return unless msg['action'] == 'terminated'
  10. p msg
  11. end
  12. end
  13.  
  14. $dboard.add_service('observer', Observer)
  15.  
  16. pdef = Ruote.define do
  17. alpha
  18. bravo
  19. end
  20.  
  21. class MyParticipant
  22. include Ruote::LocalParticipant
  23. def on_workitem
  24. puts "+++ #{workitem.participant_name} +++"
  25. reply
  26. end
  27. end
  28.  
  29. $dboard.register do
  30. catchall MyParticipant
  31. end
  32.  
  33. wfid = $dboard.launch(pdef)
  34. $dboard.wait_for(wfid)
Add Comment
Please, Sign In to add comment