Process Pilot
Process Pilot is a workflow gem for Rails applications based on the bpmn standard. It executes business processes and rules defined in a modeler.
Usage
Process Pilot executes business processes like this one.
To start the process, initialize Process Pilot with the BPMN source, then call start.
process = ProcessPilot.new(File.read("hello_world.bpmn")).startThe 'HelloWorld' process begins at the 'Start' event and waits when it reaches the 'SayHello' service task. It's often useful to print the process state to the console.
process.printHelloWorld started * Flow_0zlro9p
0 StartEvent Start: completed * out: Flow_0zlro9p
1 ServiceTask SayHello: waiting * in: Flow_0zlro9p
It's common to save the state the process until a task is complete. For example, a user task might be waiting for a person to complete a form, or a service task might run in a background job. Calling serialize on a process will return the execution state so it can be continued later.
# Returns a hash of the process state for saving in a database.
execution_state = process.serialize
# Restores the process from the execution state.
process = ProcessPilot.new(File.read("hello_world.bpmn")).restore(execution_state)After the task is completed, the waiting step is sent a signal with result.
step = process.step_by_element_id("SayHello")
step.signal(message: "Hello World!")Now the 'SayHello' task is completed, it's result is merged into the process variables, and the process continues to the 'End' event.
HelloWorld completed *
{
  "message": "Hello World!"
}
0 StartEvent Start: completed * out: Flow_0zlro9p
1 ServiceTask SayHello: completed { "message": "Hello World!" } * in: Flow_0zlro9p * out: Flow_1doumjv
2 EndEvent End: completed * in: Flow_1doumjv
Kitchen Sink
The previous example is a simple process with a single task, but BPMN can express more complex workflows.
TODO: Add a kitchen sink example.
Documentation
Installation
Execute:
$ bundle add "process_pilot"Or install it directly:
$ gem install process_pilotDevelopment
$ git clone ...
$ bin/setup
$ bin/rake
$ bin/guardLicense
The gem is available as open source under the terms of the MIT License.
Developed by Connected Bits
