WorkflowCore is under development, the codebase is unoptimized and has many bad practices, I may do breaking changes even force pushing to master branch.
In short, it's not ready yet, but I realize that a workflow engine is complicated to design and it needs a long term to done well, so I decide to open source at early stage.
Any way, feedbacks and suggestions are highly welcome!
A Rails engine which providing essential infrastructure of workflow.
WorkflowCore is originally designed for Business Process Management (BPM), in this scenario:
- Workflows are usually defined by users dynamically
- Task may tight with application features
- May meet some special or weird requirements
WorkflowCore is based on Petri Net technique, and only providing essential features for a workflow engine.
Models to describe Petri Net
There are two kinds of nodes
- Place (circles): represent the states of a system
- Transition (squares): represent state changes
WorkflowCore provides Place & Transition models that can represent a Petri Net, and a Workflow model as root.
Models to describe workflow instances
Workflow net use Token (dots in places) to tracking states of a process, every place can contain one or more tokens.
WorkflowCore provides WorkflowInstance model represent processes, and it has many tokens.
Interfaces to define how to transit
Transition has a transactional
fire method which accept a token that would consume it and generate new token(s), developer could create many kinds of transitions and overrides
on_fire to define how to transit
on_error is used for error handling.
Because it's not aim to "out-of-box", some gem like Devise giving developer an out-of-box experience, that's awesome, but on the other hand, it also introducing a very complex abstraction that may hard to understanding how it works, especially when you attempting to customize it.
I believe that the gem is tightly coupled with features that face to end users directly, so having a good customizability and easy to understanding are of the most concern, so I just wanna give you a domain framework that you can build your own that just fitting your need, and you shall have fully control and without any unnecessary abstraction.
BTW, the dummy app is a full-featured app with production level codebase that you can freely to reference it.
- Find a good way to validate all nodes of the net, when? where? how?
- Consider native workflows (those which defined in code and tight with the app) support
- Stabilizing interfaces.
- Evaluate that can supporting async, scheduled and event-based transition properly.
- Efficiency (especially database queries).
- Easy to use.
- Transforming to graph representation for visualization and other usages (e.g proving Soundness).
- Polish codebase.
- Continually improving dummy app.
- MRI 2.5+
- Rails 6.0+
See demo for now.
Add this line to your Gemfile:
Or you may want to include the gem directly from GitHub:
gem 'workflow_core', github: 'rails-engine/workflow_core'
And then execute:
$ bin/rails workflow_core:install:migrations
Then do migrate
$ bin/rails db:migrate
Demo is also under development.
You need to install Graphviz first
Clone the repository.
$ git clone https://github.com/rails-engine/workflow_core.git
$ cd workflow_core
$ bundle install
Build mruby engine & engine lib
$ bin/rails app:script_core:engine:build $ bin/rails app:script_core:engine:compile_lib
$ bin/rails db:migrate
Import sample workflow
$ bin/rails db:seed
Start the Rails server
$ bin/rails s
Open your browser, and visit
Importing workflow definitions from a BPMN2 xml,
Because there isn't have a easy-to-use web-based flowchart designer, I implement a stupid BPMN2 importer, it have many restrictions:
- Only supports
- Using gateway to fork flows must have corresponding join (