DEV Community

Jun Jiang
Jun Jiang

Posted on

FlowCore - A multi purpose, extendable, Workflow-net-based workflow engine for Rails

repo: https://github.com/rails-engine/flow_core

FlowCore is an open source Rails engine provides core workflow functionalities,
including workflow definition and workflow instance scheduling.
Easily making automation (including CI, CD, Data processing, etc.) and BPM applications or help you solve parts which changing frequently.

Features

Support all databases which based on ActiveRecord

All persistent data are present as ActiveRecord model and not use any DB-specific feature.

Easy to extend & hack

FlowCore basically followed best practice of Rails engine,
you can extend as Rails Guides suggests.

Your app-specific workflow triggers, callbacks and guards can be extended via Single Table Inheritance

FlowCore also provides callbacks for triggers (which control behavior of a transition) covered whole task lifecycle.

Petri-net based

Petri-net is a technique for description and analysis of concurrent systems.

FlowCore choose its special type called Workflow-net to expressing workflow.

Compared to more popular activity-based workflow definitions (e.g BPMN),
Petri-net has only few rules but could express very complex case.

Check workflow patterns to learn how to use Petri-net expressing workflows.

Basic workflow checking.

A workflow must be verified first before running it.

FlowCore provides the mechanism to help to prevent unexpected error on instance running

Interfaces and abstractions to integrate your business

FlowCore separate app-world and engine-world using interfaces and abstract classes,
basically you no need to know Workflow-net internal works.

Runtime error and suspend support

FlowCore provides necessary columns and event callbacks for runtime error and suspend.

A DSL to simplify workflow creation

FlowCore provides a powerful DSL for creating workflow.

For example:

FlowCore::Definition.new name: "Timed split" do |net|
  net.start_place :start
  net.end_place :end

  net.transition :t1, input: :start, output: :p
  net.transition :t2, input: :p, output: :end
  net.transition :t3, input: :start, output: :end do |t|
    t.with_trigger TransitionTriggers::Timer,
                   countdown_in_seconds: 5
  end
end.deploy!

Top comments (1)

Collapse
 
realquadrant profile image
timfong888

I have been building workflows in StackStorm which uses YAML.

Been wondering if thats the best tool for workflows. But not sure a petri based workflow is easy for most use cases.

Do you have oher wxamples?