Sha256: 994649f06538af52b3eb4870997ecfce3f99171dd87cec022d78b817c75eee58

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'

#
# instantiating an engine

engine = OpenWFE::Engine.new

#
# adding some participants

engine.register_participant :alice do |workitem|
    puts "alice got a workitem..."
    workitem.alice_comment = "this thing looks interesting"
end

engine.register_participant :bob do |workitem|
    puts "bob got a workitem..."
    workitem.bob_comment = "not for me, I prefer VB"
    workitem.bob_comment2 = "Bob rules"
end

engine.register_participant :summarize do |workitem|
    puts 
    puts "summary of process #{workitem.fei.workflow_instance_id}"
    workitem.attributes.each do |k, v|
        next unless k.match ".*_comment$"
        puts " - #{k} : '#{v}'"
    end
end

#
# a process definition

class TheProcessDefinition0 < OpenWFE::ProcessDefinition
    sequence do
        concurrence do
            participant :alice
            participant :bob
        end
        participant :summarize
    end
end

#
# launching the process

li = OpenWFE::LaunchItem.new(TheProcessDefinition0)

li.initial_comment = "please give your impressions about http://ruby-lang.org"

fei = engine.launch(li)

engine.wait_for fei

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
openwferu-0.9.15 examples/openwferu.rb
openwferu-0.9.11 examples/openwferu.rb
openwferu-0.9.12 examples/openwferu.rb
openwferu-0.9.12.863 examples/openwferu.rb
openwferu-0.9.13 examples/openwferu.rb
openwferu-0.9.14 examples/openwferu.rb
openwferu-0.9.17 examples/openwferu.rb
openwferu-0.9.16 examples/openwferu.rb
ruote-0.9.18 examples/openwferu.rb