Created
September 21, 2010 00:11
-
-
Save jmettraux/588908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'yajl-ruby', :require => 'yajl' | |
#gem 'ruote', '2.1.8' | |
gem 'ruote' | |
#gem 'ruote', :git => 'http://github.com/jmettraux/ruote.git', :branch => 'ruote2.1' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
require 'ruote' | |
PDEF_CREATE_DEAL = Ruote.process_definition :name => 'create_deal' do | |
sequence :on_error => 'process_deal_error_handler' do | |
cursor do | |
account_manager :task => 'formulate deal' | |
reviewer :task => 'review deal' | |
deal_service :task => 'process deal' | |
end | |
end | |
define 'process_deal_error_handler' do | |
echo 'in process_deal_error_handler' | |
deal_admin :task => 'review_error' | |
echo 'deal_admin replied' | |
end | |
end | |
class AccountManager | |
include Ruote::LocalParticipant | |
def cancel (fei, flavour) | |
# ignore | |
end | |
def consume (workitem) | |
raise "oops!" | |
end | |
end | |
p Ruote::VERSION | |
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new)) | |
engine.register_participant :account_manager, AccountManager | |
engine.register_participant '.+', Ruote::StorageParticipant | |
#engine.register do | |
# account_manager AccountManager | |
# catch_all | |
#end | |
# >= ruote 2.1.11 | |
engine.context.logger.noisy = true | |
#engine.noisy = true | |
# >= ruote 2.1.11 | |
engine.launch(PDEF_CREATE_DEAL) | |
engine.wait_for(:deal_admin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment