Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2013 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5173425 to your computer and use it in GitHub Desktop.
Save anonymous/5173425 to your computer and use it in GitHub Desktop.
# Gemfile
#
# ---8<---
# source :rubygems
#
# gem 'yajl-ruby', :require => 'yajl'
# #gem 'ruote'
# gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git'
# --->8---
require 'pp'
require 'ruote'
ruote =
Ruote::Dashboard.new(
Ruote::Worker.new(
Ruote::HashStorage.new))
#ruote.noisy = (ENV['NOISY'] == 'true')
ruote.noisy = true
#
# define participant classes (if needed)
#
$error_mode = true
class AlphaParticipant < Ruote::Participant
def on_workitem
puts '- ' * 40
p :alpha
puts '- ' * 40
raise 'arghhhhhhhhhhh!' if $error_mode
reply
end
end
class BravoParticipant < Ruote::Participant
def on_workitem
puts '- ' * 40
p :bravo
puts '- ' * 40
reply
end
end
#
# register participants
#
ruote.register do
participant 'alpha', AlphaParticipant
participant 'bravo', BravoParticipant
end
#
# define process
#
pdef =
Ruote.define do
alpha
bravo
end
#
# run process
#
wfid = ruote.launch(pdef)
ruote.wait_for('error_intercepted')
err = ruote.ps(wfid).errors.first
puts '-' * 80
p '--replay_at_error--'
puts '-' * 80
$error_mode = false # fix issue
ruote.replay_at_error(err)
ruote.wait_for(wfid)
puts '-' * 80
p :over
puts '-' * 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment