Sha256: 5c786034ddfba0142e1f3285620840cbc9fe32c72ad7dca8180e414bacee40e2

Contents?: true

Size: 942 Bytes

Versions: 7

Compression:

Stored size: 942 Bytes

Contents

$:.unshift('lib') # running from ruote/ probably

require 'rubygems'
require 'ruote'
require 'ruote/storage/fs_storage'

# preparing the engine

engine = Ruote::Engine.new(
  Ruote::Worker.new(
    Ruote::FsStorage.new(
      'ruote_work',
      's_logger' => [ 'ruote/log/test_logger', 'Ruote::TestLogger' ])))

# registering participants

engine.register_participant :alpha do |workitem|
  workitem.fields['message'] = { 'text' => 'hello !', 'author' => 'Alice' }
end

engine.register_participant :bravo do |workitem|
  puts "I received a message from #{workitem.fields['message']['author']}"
end

# defining a process

pdef = Ruote.process_definition :name => 'test' do
  sequence do
    participant :alpha
    participant :bravo
  end
end

# launching, creating a process instance

wfid = engine.launch(pdef)

engine.wait_for(wfid)
  # blocks current thread until our process instance terminates

# => 'I received a message from Alice'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruote-2.1.11 examples/ruote_quickstart.rb
ruote-2.1.10 examples/ruote_quickstart.rb
ruote-2.1.9 examples/ruote_quickstart.rb
ruote-2.1.8 examples/ruote_quickstart.rb
ruote-2.1.7 examples/ruote_quickstart.rb
ruote-2.1.6 examples/ruote_quickstart.rb
ruote-2.1.5 examples/ruote_quickstart.rb