SlideShare a Scribd company logo
GeoBliki
                                                                 Pat Cappelaere
                                                                        pat@geobliki.com
                                                                 Linda Derezinski
                                                                        linda@geobliki.com




And    GeoBPMS                                                    June 7th, 2007
                                           Part I
Business Process Management System For the Enterprise Using Open Source
Components


Targeted Audience: Rails Integrators, Business Process Analysts and OpenWFEru
enthusiasts.

Warning: This is not a Ruby or Rails tutorial. This document assumes that you have a
working knowledge of Ruby and Rails.

BPMS Business Case:

Sophisticated products and/or automation require the definition of service chains (or
workflows) that can involve many participants from humans to web services collaborating in
a seamless manner. These processes need to be managed and defined at the Enterprise level
and fall in a category called: Business Process Management.

This can be fairly complex and expensive. Many acronyms and technologies need to be
mastered. Our goal is to show that we can put together a solid framework based around open
source components and keep it relatively simple and manageable. Let’s walk through an
example.

Scope of this document:

- Step description of all components and tools required for BPMS and integration within
Ruby on Rails.
- Example of a workflow with code snippets.




www.geobliki.com
Introduction:

Service-chains can be defined to sequence and allocate activities or tasks across many
participants using workflows.

First step is to capture and visualize the process. A good picture is worth a thousand words.
So we need to make it look really good!

There are many ways to generate Business Process diagrams. A de-facto notation standard
has been released in Feb 2006 (BPMN1) supported by more than 42 implementations (as of
April 12, 2007). Eclipse is actively working on its own STP BPMN Modeler2. For the time
being, we will be using Business Process Visual Architect3 from Visual Paradigm.

Preflight check-list:
Before getting into the tutorial, check to see that you have everything required.

1) You have Ruby and Rails4 installed. Check that you have at least the following
versions.
     ruby –version
        ruby 1.8.6
     rails –version
       Rails 1.2.3

If you need to install Ruby on Rails:
For Windows, use Instant Rails.
For Mac OS X, use Locomotive.
For Linux, try the Rails LiveCD.

A good development environment on Macintosh is TextMate5 or Eclipse with Ruby RDT6 on
all platforms.

To get rolling with Ruby on Rails: Check this out

2) MySQL7 installed. 4.x distribution or later is fine.
    mysql –version
      mysql Ver 14.12 Distrib 5.0.20a

If you need to install MySQL download


1
  http://www.bpmn.org/
2
  http://www.eclipse.org/stp/bpmn/
3
  http://www.visual-paradigm.com/product/bpva/
4
  http://www.rubyonrails.org/
5
  http://macromates.com/
6
  http://www-128.ibm.com/developerworks/opensource/library/os-rubyeclipse/
7
  http://www.mysql.org

www.geobliki.com
Create a empty Rails application “geobpms”

    rails geobpms
        And make sure it works by testing it – Start the application
    cd geobpms
    ./script/server
        in your favorite browser, go to http://127.0.0.1:3000/

      Double check the environment one more time by selecting the “About your
      application’s environment” link. You should have these or later versions:




www.geobliki.com
Download OpenWFERu
    Go to: http://openwferu.rubyforge.org/

You can get it as a gem, latest stable version or from the svn trunk.
Note: My personal preference is to download the latest version and keep it under control so I
can go back to previous version as necessary (or check what changed between versions).

Install the gem
     gem install -y openwferu
         Successfully installed openwferu-0.9.11
         Installing ri documentation for openwferu-0.9.11...
         Installing RDoc documentation for openwferu-0.9.11...

Copy the gem into your vendor directory. In this case the current version is 0.9.11. From
your geobpms rails project directory
      cp –R /usr/local/lib/ruby/gems/1.8/gems/openwferu-0.9.11 vendor/

Edit geobpms/config/environment.rb to point to the newly installed version of openwferu

Add this text:
   config.load_paths += %W(
        vendor/openwferu-0.9.11/lib
     ).map {|dir| "#{RAILS_ROOT}/#{dir}"}.select { |dir|
   File.directory?(dir) }

Below the commented out config.load_paths line like so:




To change between versions, change the version number on line #25.




www.geobliki.com
Workflow Description:

This workflow example shows the tasking request of the EO-1 satellite by a user who interacts
with the system via XForms. The user enters a tasking request using some input (lat/long…).
The workflow proceeds by calling the Sensor Planning System (SPS) to check for feasibilities.
The user is prompted to select a feasibility and the task is submitted. Eventually, the task is
completed onboard. The data is down-linked to the ground and published by the Sensor
Observation Service (SOS). Finally the user is alerted that data is available via email by the Web
Notification Service (WNS).




Figure 1. “Simple” EO1 Satellite Tasking Workflow


www.geobliki.com
The various participants in this workflows are: XForms, SPS, SOS and WNS. They are
represented as Pools. They perform various tasks for this workflow.

Ideally, we would save this workflow in OpenWFERu XML format (or XPDL 2.0 and then
translate it). This would be a possible outcome:

Create a workflows directory in the public folder and then copy the following into flow.xml.
/rails/public/workflows/flow.xml
<process-definition
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.openwfe.org/flowdef.xsd"
    name="EO1 Simple Tasking Workflow"
    revision="0.1"
    theme="n/a"
    security="restricted" >

     <sequence>
       <set field="msg" value="Workflow has been sequenced" />
       <participant ref="WNS"      task='Email' />

       <participant ref='XForms' task='RequestTasking'    comments='Enter EO-1 Tasking Parameters'
/>

    <participant ref="SPS"       task='GetFeasibilities' timeout="2d"    comments='Check EO-1
Tasking Feasibilities'/>

       <participant ref='XForms' task='SelectFeasibility' comments='Select Desired Feasibility'
/>

       <cancel-process if="${f:status} == 'cancelled'" />

       <participant ref="SPS"    task='Submit'    comments='Submit Task to JPL'/>

       <cancel-process if="${f:status} == 'cancelled'" />

    <participant ref="SOS"       task='Publish'    comments="SOS will make raw data file
available"/>

       <set field="msg" value="You've got data" />
       <participant ref="WNS"      task='Email' />

  </sequence>
</process-definition>



Implementation Details:

Step 1: Tell OpenWFERu about those participants

I created a small class to create the workflow engine and register the participants. Some of
the participants are in-lined as examples. Major participants have their own classes.




www.geobliki.com
/rails/lib/wfe.rb

require   'openwfe/engine/engine'
require   'openwfe/expool/history'
require   'openwfe/expool/journal'
require   'openwfe/engine/file_persisted_engine'
require   'rexml/document'

class Wfe
def self.create_wfe_engine_and_participants
    #
    # === the ENGINE itself as a global variable
    #
    $engine = OpenWFE::Engine.new

    #
    # dumps all the process history in a file name "history.log"
    # in the work directory
    $engine.init_service("history", FileHistory)

    # -- process journaling
    $engine.init_service("journal", Journal)
    $engine.application_context[:keep_journals] = true

    #
    # === some LISTENERS
    #

    #
    # === the PARTICIPANTS
    #
    $engine.register_participant :WPS do |workitem|
      puts "wps output file:"+workitem.processed_file
    end

    $engine.register_participant("XForms", XformParticipant.new )

    $engine.register_participant("SPS", SpsParticipant.new )

    $engine.register_participant :WNS do | flowexpression, workitem|
      # Check msg and email it
      puts "WNS Task:"+workitem.params['task']
      puts "msg:"+workitem.msg
    end

    $engine.register_participant :SOS do | flowexpression, workitem|
      puts "SOS Task:"+workitem.params['task']
    end

    puts "workflow engine started..."
  end
end



At the bottom of your environment file /rails/config/environment.rb, add these lines:

require "wfe"
Wfe.create_wfe_engine_and_participants




www.geobliki.com
Now we need to create our SPS participant. The Sensor Planning Service is a web service
that requires the posting of specific XML snippets to a URL. This service has many methods
and we will only use two of them:
 - GetFeasibilities, to return the imaging feasibilities for a specific latitude/longitude.
 - Submit, to package the requested parameters and request the tasking to happen.

The various tasks of this participant will pick up the required parameters in the workitem.
The user will have entered those parameters in previous steps (later for more information)

Let’s create two stubbed participants, to get our first workflow working

/rails/lib/sps_participant.rb

require 'openwfe/participants/participant'

class SpsParticipant
  include LocalParticipant

  def logger
    @logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT)
  end

  #
  # Consume the workitem received from engine
  #
  def consume (workitem)
    fe    = get_flow_expression(workitem)
    task = fe.attributes['task']

      raise "request parameter is undefined" if task == nil

    logger.debug("SPS Participant Request: #{task}")
    reply_to_engine(workitem)
  end

end




www.geobliki.com
and /rails/lib/xform_participant.rb

require 'openwfe/participants/participant'

class XformParticipant
  include LocalParticipant

  def logger
    @logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT)
  end

  #
  # Consume the workitem received from engine
  #
  def consume (workitem)
    fe    = get_flow_expression(workitem)
    task = fe.attributes['task']

      raise "request parameter is undefined" if task == nil

    logger.debug("XForm Participant Request: #{task}")
    reply_to_engine(workitem)
  end

end



How Do I execute a Workflow?

Somehow the user could discover what workflows are available, pick one from a list or a
database.

One could quickly create a rails controller and a launch method. Other methods can be
written to view, add, delete workflows to the list…

Let’s create a rails controller “Worklist” and 2 methods: intialize & launch. From the rails
project directory:
     ./script/generate controller Worklist initialize launch




www.geobliki.com
Let’s edit the file generated in geobpms/app/controller/worklist_controller.rb.
We will complete the initialize and launch methods.

class WorklistController < ApplicationController

  def initialize
    @workflows_dir = "#{RAILS_ROOT}/public/workflows/"
  end

  def launch
    workflow_name = params[:id]

    #get the process flow from file based on passed-in parameter
    flow = IO.read("#{@workflows_dir}#{workflow_name}.xml")

    launchitem = LaunchItem.new(flow)

    fei,t = $engine.launch(launchitem)

    puts "launching fei: #{fei.to_s}"
    puts "inspect:"+fei.inspect

    @wfid = fei.wfid
  end
end


Before running this, let’s quickly add a view to render the results
Rails has created for us:

/geobpms/app/views/worklist/launch.rhtml

<h1>Worklist#launch</h1>
 <h2>Your workflow has been launched successfully!</h2>
 <h3> Flow id: <%= @wfid %></h3>


Time to test it out to see what we have so far:

Start your application
     ./script/server
       => Booting Mongrel (use 'script/server webrick' to force WEBrick)
       => Rails application starting on http://0.0.0.0:3000
       => Call with -d to detach
       => Ctrl-C to shutdown server
       ** Starting Mongrel listening at 0.0.0.0:3000
       ** Starting Rails with development environment...
       workflow engine started...
       ** Rails loaded.
       ** Loading any Rails specific GemPlugins
       ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no
       restart).
       ** Rails signals registered. HUP => reload (without restart). It
       might not work well.
       ** Mongrel available at 0.0.0.0:3000
       ** Use CTRL-C to stop.




www.geobliki.com
and from your web browser, try this:
http://localhost:3000/worklist/launch/flow

You should see in your browser something like:




The terminal window should show something like:

launching fei: (fei 0.9.11 engine/engine field:__definition
EO1_Simple_Tasking_Workflow 0.1 20070606-koyobibute process-definition 0)
inspect:#<OpenWFE::FlowExpressionId:0x322cc7c
@workflow_definition_revision="0.1", @engine_id="engine",
@workflow_definition_name="EO1_Simple_Tasking_Workflow",
@expression_name="process-definition", @expression_id="0",
@initial_engine_id="engine", @workflow_instance_id="20070606-koyobibute",
@workflow_definition_url="field:__definition", @owfe_version="0.9.11">
WNS Task:Email
msg:Workflow has been sequenced
SOS Task:Publish
WNS Task:Email
msg:You've got data


Processing WorklistController#launch (for 127.0.0.1 at 2007-06-06
15:19:21) [GET]
  Session ID: cebe910aa8bbad3201d752b6d5ddde4c
  Parameters: {"action"=>"launch", "id"=>"flow", "controller"=>"worklist"}
script/../config/../public/workflows/flow.xml
Rendering worklist/launch
Completed in 0.01020 (98 reqs/sec) | Rendering: 0.00111 (10%) | 200 OK
[http://localhost/worklist/launch/flow]
XForm Participant Request: RequestTasking
SPS Participant Request: GetFeasibilities
XForm Participant Request: SelectFeasibility
SPS Participant Request: Submit

Congratulations, you have successfully run your first workflow within Rails!

In the tradition of Rails, we need to capture this milestone and create a test.
[We should have written the test first …]

Note: If you haven’t already stopped your application, do that now by pressing CTRL-C in
the terminal window.


www.geobliki.com
First lets get the databases setup. Edit your database configuration file:
geobpms/config/database.yml

Set the username and password for each of the databases to what ever you would like to use.
In MySQL create geobpms_development, geobpms_test, geobpms_production databases
with the username and password you put in database.yml.

Go to your application directory and type:
   rake test
   (in /Users/linda/work/geobpms)
   workflow engine started...
   /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-
   0.7.3/lib/rake/rake_test_loader.rb"
   /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-
   0.7.3/lib/rake/rake_test_loader.rb"
   "test/functional/worklist_controller_test.rb"
   workflow engine started...
   Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-
   0.7.3/lib/rake/rake_test_loader
   Started
   .
   Finished in 0.038817 seconds.

   1 tests, 1 assertions, 0 failures, 0 errors
   /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-
   0.7.3/lib/rake/rake_test_loader.rb" and it should pass.

Rails already created a test stub for your controller in:
geobpms/test/functional/worklist_controller_test.rb

Now we need to replace the test_truth method with something like:

def test_launch_flow
  get :launch, :id=>"flow"
  assert_template 'launch'
end

Exercise the test:
    rake test
       (in /Users/linda/work/geobpms)
       workflow engine started...
       /usr/local/bin/ruby -Ilib:test
       "/usr/local/lib/ruby/gems/1.8/gems/rake-
       0.7.3/lib/rake/rake_test_loader.rb"
       /usr/local/bin/ruby -Ilib:test
       "/usr/local/lib/ruby/gems/1.8/gems/rake-
       0.7.3/lib/rake/rake_test_loader.rb"
       "test/functional/worklist_controller_test.rb"
       workflow engine started...
       Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-
       0.7.3/lib/rake/rake_test_loader
       Started


www.geobliki.com
launching fei: (fei 0.9.11 engine/engine field:__definition
       EO1_Simple_Tasking_Workflow 0.1 20070606-kusokadami process-
       definition 0)
       inspect:#<OpenWFE::FlowExpressionId:0x3216490
       @expression_name="process-definition",
       @workflow_definition_url="field:__definition", @engine_id="engine",
       @initial_engine_id="engine", @workflow_instance_id="20070606-
       kusokadami", @owfe_version="0.9.11", @expression_id="0",
       @workflow_definition_revision="0.1",
       @workflow_definition_name="EO1_Simple_Tasking_Workflow">
       .
       Finished in 0.082942 seconds.

       1 tests, 1 assertions, 0 failures, 0 errors
       /usr/local/bin/ruby -Ilib:test
       "/usr/local/lib/ruby/gems/1.8/gems/rake-
       0.7.3/lib/rake/rake_test_loader.rb"



Congratulations, you have successfully run your first workflow test within Rails!



TO BE CONTINUED.




www.geobliki.com

More Related Content

PDF
YouDrup_in_Drupal
PDF
PDF
backend
PDF
How%20to%20install%20PHP%20on%20Linux%20_%20laffers
PDF
AspNetWhitePaper
PDF
Perl%20Tutorial.!Picking%20Up%20Perl
ODP
CodeIgniter PHP MVC Framework
PDF
How to deploy PHP projects with docker
YouDrup_in_Drupal
backend
How%20to%20install%20PHP%20on%20Linux%20_%20laffers
AspNetWhitePaper
Perl%20Tutorial.!Picking%20Up%20Perl
CodeIgniter PHP MVC Framework
How to deploy PHP projects with docker

What's hot (20)

PDF
Using Composer with Drupal and Drush
PDF
Martin Aspeli Extending And Customising Plone 3
PPTX
Access google command list from the command line
PDF
Django in the Real World
PDF
Composer tools and frameworks for drupal.ppt
PPT
Learn flask in 90mins
PDF
Zero Downtime Deployment with Ansible
PDF
Ansible project-deploy
PDF
Hands on Docker - Launch your own LEMP or LAMP stack
PDF
PECL Picks - Extensions to make your life better
PDF
Zero Downtime Deployment with Ansible
PPTX
Performance all teh things
PDF
Configuring Django projects for multiple environments
PDF
Creating a full stack web app with python, npm, webpack and react
PPTX
Node JS Express : Steps to Create Restful Web App
PDF
os-php-wiki5-a4
PDF
Installing AtoM with Ansible
PDF
A Node.JS bag of goodies for analyzing Web Traffic
PDF
BaláZs Ree Introduction To Kss, Kinetic Style Sheets
PPT
A web perf dashboard up & running in 90 minutes presentation
Using Composer with Drupal and Drush
Martin Aspeli Extending And Customising Plone 3
Access google command list from the command line
Django in the Real World
Composer tools and frameworks for drupal.ppt
Learn flask in 90mins
Zero Downtime Deployment with Ansible
Ansible project-deploy
Hands on Docker - Launch your own LEMP or LAMP stack
PECL Picks - Extensions to make your life better
Zero Downtime Deployment with Ansible
Performance all teh things
Configuring Django projects for multiple environments
Creating a full stack web app with python, npm, webpack and react
Node JS Express : Steps to Create Restful Web App
os-php-wiki5-a4
Installing AtoM with Ansible
A Node.JS bag of goodies for analyzing Web Traffic
BaláZs Ree Introduction To Kss, Kinetic Style Sheets
A web perf dashboard up & running in 90 minutes presentation
Ad

Viewers also liked (6)

PDF
YouDrup_in_Drupal
PDF
PDF
d_vbp_print
PDF
newperl5
PDF
AspNetWhitePaper
PDF
TemplateTutorial
YouDrup_in_Drupal
d_vbp_print
newperl5
AspNetWhitePaper
TemplateTutorial
Ad

Similar to BPMS1 (20)

KEY
Supa fast Ruby + Rails
PDF
Create a new project in ROR
PDF
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
PPTX
RoR guide_p1
PPTX
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
PPTX
Dev streams2
PDF
Ruby On Rails Basics
PDF
Openshift cheat rhce_r3v1 rhce
PDF
sveltekit-en.pdf
PDF
Workflow Yapceu2010
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
PDF
Extending Oracle E-Business Suite with Ruby on Rails
PDF
TorqueBox
PDF
NodeJS @ ACS
PPTX
Introduction to Node.JS
PDF
Beginning MEAN Stack
PPTX
Introduction to node.js
PPT
Ruby On Rails
PPTX
High Performance NodeJS
PPTX
Devopstore
Supa fast Ruby + Rails
Create a new project in ROR
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
RoR guide_p1
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Dev streams2
Ruby On Rails Basics
Openshift cheat rhce_r3v1 rhce
sveltekit-en.pdf
Workflow Yapceu2010
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Extending Oracle E-Business Suite with Ruby on Rails
TorqueBox
NodeJS @ ACS
Introduction to Node.JS
Beginning MEAN Stack
Introduction to node.js
Ruby On Rails
High Performance NodeJS
Devopstore

More from tutorialsruby (20)

PDF
&lt;img src="../i/r_14.png" />
PDF
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
PDF
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
PDF
&lt;img src="../i/r_14.png" />
PDF
&lt;img src="../i/r_14.png" />
PDF
Standardization and Knowledge Transfer – INS0
PDF
xhtml_basics
PDF
xhtml_basics
PDF
xhtml-documentation
PDF
xhtml-documentation
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
PDF
HowTo_CSS
PDF
HowTo_CSS
PDF
BloggingWithStyle_2008
PDF
BloggingWithStyle_2008
PDF
cascadingstylesheets
PDF
cascadingstylesheets
&lt;img src="../i/r_14.png" />
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
Standardization and Knowledge Transfer – INS0
xhtml_basics
xhtml_basics
xhtml-documentation
xhtml-documentation
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
HowTo_CSS
HowTo_CSS
BloggingWithStyle_2008
BloggingWithStyle_2008
cascadingstylesheets
cascadingstylesheets

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Monthly Chronicles - July 2025
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm

BPMS1

  • 1. GeoBliki Pat Cappelaere pat@geobliki.com Linda Derezinski linda@geobliki.com And GeoBPMS June 7th, 2007 Part I Business Process Management System For the Enterprise Using Open Source Components Targeted Audience: Rails Integrators, Business Process Analysts and OpenWFEru enthusiasts. Warning: This is not a Ruby or Rails tutorial. This document assumes that you have a working knowledge of Ruby and Rails. BPMS Business Case: Sophisticated products and/or automation require the definition of service chains (or workflows) that can involve many participants from humans to web services collaborating in a seamless manner. These processes need to be managed and defined at the Enterprise level and fall in a category called: Business Process Management. This can be fairly complex and expensive. Many acronyms and technologies need to be mastered. Our goal is to show that we can put together a solid framework based around open source components and keep it relatively simple and manageable. Let’s walk through an example. Scope of this document: - Step description of all components and tools required for BPMS and integration within Ruby on Rails. - Example of a workflow with code snippets. www.geobliki.com
  • 2. Introduction: Service-chains can be defined to sequence and allocate activities or tasks across many participants using workflows. First step is to capture and visualize the process. A good picture is worth a thousand words. So we need to make it look really good! There are many ways to generate Business Process diagrams. A de-facto notation standard has been released in Feb 2006 (BPMN1) supported by more than 42 implementations (as of April 12, 2007). Eclipse is actively working on its own STP BPMN Modeler2. For the time being, we will be using Business Process Visual Architect3 from Visual Paradigm. Preflight check-list: Before getting into the tutorial, check to see that you have everything required. 1) You have Ruby and Rails4 installed. Check that you have at least the following versions.  ruby –version ruby 1.8.6  rails –version Rails 1.2.3 If you need to install Ruby on Rails: For Windows, use Instant Rails. For Mac OS X, use Locomotive. For Linux, try the Rails LiveCD. A good development environment on Macintosh is TextMate5 or Eclipse with Ruby RDT6 on all platforms. To get rolling with Ruby on Rails: Check this out 2) MySQL7 installed. 4.x distribution or later is fine.  mysql –version mysql Ver 14.12 Distrib 5.0.20a If you need to install MySQL download 1 http://www.bpmn.org/ 2 http://www.eclipse.org/stp/bpmn/ 3 http://www.visual-paradigm.com/product/bpva/ 4 http://www.rubyonrails.org/ 5 http://macromates.com/ 6 http://www-128.ibm.com/developerworks/opensource/library/os-rubyeclipse/ 7 http://www.mysql.org www.geobliki.com
  • 3. Create a empty Rails application “geobpms”  rails geobpms And make sure it works by testing it – Start the application  cd geobpms  ./script/server in your favorite browser, go to http://127.0.0.1:3000/ Double check the environment one more time by selecting the “About your application’s environment” link. You should have these or later versions: www.geobliki.com
  • 4. Download OpenWFERu Go to: http://openwferu.rubyforge.org/ You can get it as a gem, latest stable version or from the svn trunk. Note: My personal preference is to download the latest version and keep it under control so I can go back to previous version as necessary (or check what changed between versions). Install the gem  gem install -y openwferu Successfully installed openwferu-0.9.11 Installing ri documentation for openwferu-0.9.11... Installing RDoc documentation for openwferu-0.9.11... Copy the gem into your vendor directory. In this case the current version is 0.9.11. From your geobpms rails project directory  cp –R /usr/local/lib/ruby/gems/1.8/gems/openwferu-0.9.11 vendor/ Edit geobpms/config/environment.rb to point to the newly installed version of openwferu Add this text: config.load_paths += %W( vendor/openwferu-0.9.11/lib ).map {|dir| "#{RAILS_ROOT}/#{dir}"}.select { |dir| File.directory?(dir) } Below the commented out config.load_paths line like so: To change between versions, change the version number on line #25. www.geobliki.com
  • 5. Workflow Description: This workflow example shows the tasking request of the EO-1 satellite by a user who interacts with the system via XForms. The user enters a tasking request using some input (lat/long…). The workflow proceeds by calling the Sensor Planning System (SPS) to check for feasibilities. The user is prompted to select a feasibility and the task is submitted. Eventually, the task is completed onboard. The data is down-linked to the ground and published by the Sensor Observation Service (SOS). Finally the user is alerted that data is available via email by the Web Notification Service (WNS). Figure 1. “Simple” EO1 Satellite Tasking Workflow www.geobliki.com
  • 6. The various participants in this workflows are: XForms, SPS, SOS and WNS. They are represented as Pools. They perform various tasks for this workflow. Ideally, we would save this workflow in OpenWFERu XML format (or XPDL 2.0 and then translate it). This would be a possible outcome: Create a workflows directory in the public folder and then copy the following into flow.xml. /rails/public/workflows/flow.xml <process-definition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.openwfe.org/flowdef.xsd" name="EO1 Simple Tasking Workflow" revision="0.1" theme="n/a" security="restricted" > <sequence> <set field="msg" value="Workflow has been sequenced" /> <participant ref="WNS" task='Email' /> <participant ref='XForms' task='RequestTasking' comments='Enter EO-1 Tasking Parameters' /> <participant ref="SPS" task='GetFeasibilities' timeout="2d" comments='Check EO-1 Tasking Feasibilities'/> <participant ref='XForms' task='SelectFeasibility' comments='Select Desired Feasibility' /> <cancel-process if="${f:status} == 'cancelled'" /> <participant ref="SPS" task='Submit' comments='Submit Task to JPL'/> <cancel-process if="${f:status} == 'cancelled'" /> <participant ref="SOS" task='Publish' comments="SOS will make raw data file available"/> <set field="msg" value="You've got data" /> <participant ref="WNS" task='Email' /> </sequence> </process-definition> Implementation Details: Step 1: Tell OpenWFERu about those participants I created a small class to create the workflow engine and register the participants. Some of the participants are in-lined as examples. Major participants have their own classes. www.geobliki.com
  • 7. /rails/lib/wfe.rb require 'openwfe/engine/engine' require 'openwfe/expool/history' require 'openwfe/expool/journal' require 'openwfe/engine/file_persisted_engine' require 'rexml/document' class Wfe def self.create_wfe_engine_and_participants # # === the ENGINE itself as a global variable # $engine = OpenWFE::Engine.new # # dumps all the process history in a file name "history.log" # in the work directory $engine.init_service("history", FileHistory) # -- process journaling $engine.init_service("journal", Journal) $engine.application_context[:keep_journals] = true # # === some LISTENERS # # # === the PARTICIPANTS # $engine.register_participant :WPS do |workitem| puts "wps output file:"+workitem.processed_file end $engine.register_participant("XForms", XformParticipant.new ) $engine.register_participant("SPS", SpsParticipant.new ) $engine.register_participant :WNS do | flowexpression, workitem| # Check msg and email it puts "WNS Task:"+workitem.params['task'] puts "msg:"+workitem.msg end $engine.register_participant :SOS do | flowexpression, workitem| puts "SOS Task:"+workitem.params['task'] end puts "workflow engine started..." end end At the bottom of your environment file /rails/config/environment.rb, add these lines: require "wfe" Wfe.create_wfe_engine_and_participants www.geobliki.com
  • 8. Now we need to create our SPS participant. The Sensor Planning Service is a web service that requires the posting of specific XML snippets to a URL. This service has many methods and we will only use two of them: - GetFeasibilities, to return the imaging feasibilities for a specific latitude/longitude. - Submit, to package the requested parameters and request the tasking to happen. The various tasks of this participant will pick up the required parameters in the workitem. The user will have entered those parameters in previous steps (later for more information) Let’s create two stubbed participants, to get our first workflow working /rails/lib/sps_participant.rb require 'openwfe/participants/participant' class SpsParticipant include LocalParticipant def logger @logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT) end # # Consume the workitem received from engine # def consume (workitem) fe = get_flow_expression(workitem) task = fe.attributes['task'] raise "request parameter is undefined" if task == nil logger.debug("SPS Participant Request: #{task}") reply_to_engine(workitem) end end www.geobliki.com
  • 9. and /rails/lib/xform_participant.rb require 'openwfe/participants/participant' class XformParticipant include LocalParticipant def logger @logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT) end # # Consume the workitem received from engine # def consume (workitem) fe = get_flow_expression(workitem) task = fe.attributes['task'] raise "request parameter is undefined" if task == nil logger.debug("XForm Participant Request: #{task}") reply_to_engine(workitem) end end How Do I execute a Workflow? Somehow the user could discover what workflows are available, pick one from a list or a database. One could quickly create a rails controller and a launch method. Other methods can be written to view, add, delete workflows to the list… Let’s create a rails controller “Worklist” and 2 methods: intialize & launch. From the rails project directory:  ./script/generate controller Worklist initialize launch www.geobliki.com
  • 10. Let’s edit the file generated in geobpms/app/controller/worklist_controller.rb. We will complete the initialize and launch methods. class WorklistController < ApplicationController def initialize @workflows_dir = "#{RAILS_ROOT}/public/workflows/" end def launch workflow_name = params[:id] #get the process flow from file based on passed-in parameter flow = IO.read("#{@workflows_dir}#{workflow_name}.xml") launchitem = LaunchItem.new(flow) fei,t = $engine.launch(launchitem) puts "launching fei: #{fei.to_s}" puts "inspect:"+fei.inspect @wfid = fei.wfid end end Before running this, let’s quickly add a view to render the results Rails has created for us: /geobpms/app/views/worklist/launch.rhtml <h1>Worklist#launch</h1> <h2>Your workflow has been launched successfully!</h2> <h3> Flow id: <%= @wfid %></h3> Time to test it out to see what we have so far: Start your application  ./script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... workflow engine started... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel available at 0.0.0.0:3000 ** Use CTRL-C to stop. www.geobliki.com
  • 11. and from your web browser, try this: http://localhost:3000/worklist/launch/flow You should see in your browser something like: The terminal window should show something like: launching fei: (fei 0.9.11 engine/engine field:__definition EO1_Simple_Tasking_Workflow 0.1 20070606-koyobibute process-definition 0) inspect:#<OpenWFE::FlowExpressionId:0x322cc7c @workflow_definition_revision="0.1", @engine_id="engine", @workflow_definition_name="EO1_Simple_Tasking_Workflow", @expression_name="process-definition", @expression_id="0", @initial_engine_id="engine", @workflow_instance_id="20070606-koyobibute", @workflow_definition_url="field:__definition", @owfe_version="0.9.11"> WNS Task:Email msg:Workflow has been sequenced SOS Task:Publish WNS Task:Email msg:You've got data Processing WorklistController#launch (for 127.0.0.1 at 2007-06-06 15:19:21) [GET] Session ID: cebe910aa8bbad3201d752b6d5ddde4c Parameters: {"action"=>"launch", "id"=>"flow", "controller"=>"worklist"} script/../config/../public/workflows/flow.xml Rendering worklist/launch Completed in 0.01020 (98 reqs/sec) | Rendering: 0.00111 (10%) | 200 OK [http://localhost/worklist/launch/flow] XForm Participant Request: RequestTasking SPS Participant Request: GetFeasibilities XForm Participant Request: SelectFeasibility SPS Participant Request: Submit Congratulations, you have successfully run your first workflow within Rails! In the tradition of Rails, we need to capture this milestone and create a test. [We should have written the test first …] Note: If you haven’t already stopped your application, do that now by pressing CTRL-C in the terminal window. www.geobliki.com
  • 12. First lets get the databases setup. Edit your database configuration file: geobpms/config/database.yml Set the username and password for each of the databases to what ever you would like to use. In MySQL create geobpms_development, geobpms_test, geobpms_production databases with the username and password you put in database.yml. Go to your application directory and type:  rake test (in /Users/linda/work/geobpms) workflow engine started... /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" "test/functional/worklist_controller_test.rb" workflow engine started... Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader Started . Finished in 0.038817 seconds. 1 tests, 1 assertions, 0 failures, 0 errors /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" and it should pass. Rails already created a test stub for your controller in: geobpms/test/functional/worklist_controller_test.rb Now we need to replace the test_truth method with something like: def test_launch_flow get :launch, :id=>"flow" assert_template 'launch' end Exercise the test:  rake test (in /Users/linda/work/geobpms) workflow engine started... /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" "test/functional/worklist_controller_test.rb" workflow engine started... Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader Started www.geobliki.com
  • 13. launching fei: (fei 0.9.11 engine/engine field:__definition EO1_Simple_Tasking_Workflow 0.1 20070606-kusokadami process- definition 0) inspect:#<OpenWFE::FlowExpressionId:0x3216490 @expression_name="process-definition", @workflow_definition_url="field:__definition", @engine_id="engine", @initial_engine_id="engine", @workflow_instance_id="20070606- kusokadami", @owfe_version="0.9.11", @expression_id="0", @workflow_definition_revision="0.1", @workflow_definition_name="EO1_Simple_Tasking_Workflow"> . Finished in 0.082942 seconds. 1 tests, 1 assertions, 0 failures, 0 errors /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake- 0.7.3/lib/rake/rake_test_loader.rb" Congratulations, you have successfully run your first workflow test within Rails! TO BE CONTINUED. www.geobliki.com