Giter VIP home page Giter VIP logo

process_pilot's Introduction

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.

Example

To start the process, initialize Process Pilot with the BPMN source, then call start.

process = ProcessPilot.new(File.read("hello_world.bpmn")).start

The '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.print
HelloWorld 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_pilot

Development

$ git clone ...
$ bin/setup
$ bin/rake
$ bin/guard

License

The gem is available as open source under the terms of the MIT License.

Developed by Connected Bits

process_pilot's People

Contributors

carlson avatar jqr avatar netshade avatar

Stargazers

dave mitchell avatar  avatar

Watchers

 avatar  avatar dave mitchell avatar  avatar

Forkers

spot-service

process_pilot's Issues

Step execution error handling

Step execution errors should be handled (capturing error information in the step state). This behavior will enable ErrorEventDefinitions to work properly.

Add support for listeners

Listeners enable callback behavior necessary for Rails apps to manage persistence and react to process behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.