Hi John,
below I have inserted a small process example for a tender process.
In this process I used the discussed participant the :behaviour
parameter.
I will use the example to discuss some aspects which are related this
participant notation.
One interessting aspect for me is the opportunity to use one topic for
publishing of tasks and to use another topic for listening for
incomming responses.
If we do so there could be a problem related to this portion of the
end of the subprocess
# this participant should receive a offer from the web application
# which is responsable for supplier communication
participant :offer_receiver, :behaviour => :listen
If the message (from the web application) which is published to
TenderSupplierResponseTopic does'nt contain the @flow_expression_id
then the response potentially can not be assigned to the correct
subprocess instance.
>From my point of view there are two opportunities:
1. constructing a workitem setting the @flow_expression_id explicit,
that means the application have to store the
@flow_expression_id of a received message and use this ID later in the
right context.
2. I use some meaningful parameter which build an unique "process
instance key" which play the same role as the
@flow_expression_id.
I would prefer the second oportunity. If I would use this opportunity
I can easily implement an event listener which can be addressed from
the out site using some process knowlege ( process knowlege about what
are the parts of the unique "process instance key").
In my example the name of the subprocess ("supplierCommunication")
and the parameter "DunsNr" build the unique "process instance key".
process_definition :name => "supplierCommunication"
What do you think ?
Best regards
Andreas
#-----------------------------------------------------------------------------------------
require 'rubygems'
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'
require 'openwfe/extras/participants/sqsparticipants'
require 'openwfe/extras/participants/activemqparticipants'
require 'openwfe/extras/listeners/sqslisteners'
require 'openwfe/expressions/raw_prog'
require 'openwfe/tools/flowtracer'
engine = OpenWFE::Engine.new
engine.register_participant :logger do |workitem|
if workitem.lookup_attribute('params.debug')
debugmsg = workitem.lookup_attribute("params.debug")
puts
puts("------------ DEBUG Message ---------------------")
puts "debugmsg:",debugmsg
puts "workItem:"
puts workitem.inspect
puts("------------ END DEBUG Message ---------------------")
puts
else
puts workitem.lookup_attribute("params.msg")
end
end
engine.register_participant :subprocessInitializer do |workitem|
p = workitem.lookup_attribute("params")
workitem.attributes ={}
p.each do |key,value|
workitem.attributes[key] = value
end
puts "subprocessInitializer:", workitem.inspect
end
engine.register_participant(:tender_sender,
OpenWFE::Extras::ActiveMQPublisherParticipant.new("TenderTaskTopic"))
engine.register_participant(:escalation_sender,
OpenWFE::Extras::ActiveMQPublisherParticipant.new("EscalationAlertTopic"))
engine.register_participant(:offer_receiver,
OpenWFE::Extras::ActiveMQSubscriberParticipant.new("TenderSupplierResponseTopic"))
class TenderProcessDefinition < OpenWFE::ProcessDefinition
sequence do
participant :logger, :msg =>"This is a Tender Test Process"
concurrent_iterator :on_value =>"${f:supplierList}" ,:to_field
=>"dunsnr" do
sequence do
participant :logger, :msg =>"Start subprocess for DunsNr: $
{f:dunsnr}"
subprocess :ref =>"supplierCommunication", :DunsNr => "$
{f:dunsnr}", :processData => "${f:TenderDataList.${f:dunsnr}}"
end
end
end
set :field => "TenderDataList", :value => {"JGE4753" =>
{"TenderDataItem1" => "xxaxaax","TenderDataItem2" =>"5322"},
"ZUTE8555" =>
{"TenderDataItem1" => "as assas","TenderDataItem2"
=>"2334244"},
"GTI6775" =>
{"TenderDataItem1" => "sdf vfg","TenderDataItem2" =>"73443434"},
"XUE6755" =>
{"TenderDataItem1" => "ewewfs","TenderDataItem2" =>"5872332"}
}
set :field => "supplierList", :value =>
"JGE4753,ZUTE8555,GTI6775,XUE6755"
#subprocess definition
process_definition :name => "supplierCommunication" do
param :field => "DunsNr"
param :field => "processData"
sequence do
participant :logger, :msg =>"Subprocess with DunsNr $
{DunsNr} started"
participant :logger, :msg =>"Subprocess data: $
{processData} "
participant :subprocessInitializer, :processData => "$
{processData}", :DunsNr => "${DunsNr}"
_timeout :after => "2w" do
# the receiving application which is listen to
TenderTaskTopic will generate Tasks
participant :tender_sender, :behaviour => :send
concurrence do
# do some other work
# test condition should be modified - only a
intentionally notation is shown
_when :test =>"${f:current_date} == ${f:duedate -
2}", :frequency => "1h" do
# the receiving application which is listen to
EscalationAlertTopic will generate an escalation alert
participant :escalation_sender, behaviour
=> :send, :msg =>"The duedate will be in two days. We need your
offer"
end
# this participant should receive a offer from the
web application
# which is responsable for supplier communication
participant :offer_receiver, :behaviour => :listen
# do some other work
end
end
end
end
end
li = OpenWFE::LaunchItem.new(TenderProcessDefinition)
#OpenWFE::trace_flow(TenderProcessDefinition)
li.initial_comment = "please give your impressions about http://ruby-lang.org"
fei = engine.launch(li)
engine.wait_for fei
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-dev?hl=en
-~----------~----~----~----~------~----~------~--~---