What is BPE? BPE is an production grade business workflow engine that is enought for managing automated procesess. It can substitute WWF, BizTalk, Activity or Oracle BPM for those who understand the basic features of workflow systems. BPE is an subset of BPMN 2.0 standart, the evelution and unification of most previous worflow standard such as XPDL, BPML, OpenWFE, WWF and jBPM.
Picture. Process Sample
This project was written essentially for biggest ukrainian commercial bank and is based on previous research work already done by athor for CLR platform. You may read a dedicated book about Workflow Process theory written by BPE author earlier while this book is dedicated essentially to BPE application and its companion libraries. The same way as web frameworks are the core of web applications, the workflow engine is a core of business applications.
In its core BPE is microkernel that accept native Erlang record-based process definition in Erlang language along with Event-Condition-Action erlang functions, similar you may find in OTP principles, but much simplified, intended for business analytics and system integration engineers. It acts like FSM machine, runned under Erlang supervision and is totally persisted, which means no data loss can be happened. It has very clean and minimalistic API for keeping this product robust and stable, th approach you already can find in Synrc stack in common and in N2O framework in particular.
BPE context holds KVS documents which in fact typed Erlang records and are defined by KVS schema. Each process has its own persistent execution log and is fully fault-resistant with migration capabilities. The BPE protocol is well defined and is a part of N2O protocols stack.
The author of BPE has implemented business workflow engine for CLR virtual machine using C# language. However Erlang implementation more idiomatic and canonical due to semantic corresponding of process calculus and the core of underlying virtual machine. Send async messages across processes means exactly what it says up to Erlang pids. For sending documents to business process you can use process’s name or its Pid:
Thanks to this isomorphic corresponding between Erlang process and Calculus process, code size of core BPE server was reduced to 400 lines of code. This is definitely most clean functional implementation of workflow engine avalible in electronical banking systems.
The nice thing about all palette of different implementation of workflow models is that all of them reduced to one of two kinds of encoding: one is algebraic one and the other is geometric.
The geometric one is Petri nets. Carl Petri introduced it in 1962 during discrete analysis of asynchronous computer systems. Any its graphical representation could be defined with Petri nets formalism. Petri modeling in one of its forms is a good complementation to process algebra useful as computational model.
The algebraic one is Pi-calculus developed by Robin Milner who gained Turing award for 1) Meta Language ML, 2) Calculus for Communication Systems CCS (1980), the general theory of concurrency and 3) theoretical base for proof assistants, Logic for Computable Functions LCF. The model of process calculus is a theoretical background of virtual environment of Erlang infrastructure, so BPE implementation fully relies on Pi-calculus (1999), the successor of CCS notion. Thus providing effective computational model for implementation of workflow process management.
One of the common known types of encoding process calculus is well developed FSM framework (60-s). This language is widely used almost in any programming language presented as core feature or as library. The process defines with an extension to Turing machine with states, input, outputs and functions.
The next language (framework) that used in (80-s, 90-s) to describe similar to process calculus definitions with graphical Petri nets and model definitions was SADT introduced by Marca and MacGowan 1988, 1991.
One of the wide range of semantics is Reactive Systems based on message passing and event routing, but also it could be known as Functional Reactive Programming FRP which is rather a set of combinators over streams. Both interpretations are used in languages and frameworks, depending on involvement of stream in core definition (2010-s).
In typed theory Pi-calculus defines also the typing system (could be System F, e.g.) for input and outputs of processes or function signatures specified in process definition. In BPE the role of types was taken by document types, which is simple Erlang records, so in BPE workflow processing is type-safe on compilation stage with respect to document types.
Workflows are complimentary to business rules and could be specified separately. BPE definitions provides front API to the end-user application. Workflow Engine – is an Erlang/OTP application which handles process definitions, process instances, and provides very clean API for Workplaces.
Before using Process Engine you need to define the set of business process workflows of your enterprise. This could be done via Erlang terms or some DSL that lately converted to Erlang terms. Internally BPE uses Erlang terms workflow definition:
Slightly bigger example:
Business rules should be specified by developers. RETE is used for rules specifications which can be triggered during workflow.
The workflow definition uses following persistent workflow model which is stored in KVS:
Full set of BPMN 2.0 fields could be obtained at OMG definition document, page 3-7.
Unusual that BPE process implemented as gen_server rather that gen_fsm: