process-engine
v0.5.3
Published
Javascript Process Engine
Downloads
40
Readme
Process automation for Node.js
###Best For
- Task Orchestration
- Human Task Management
- Process Management and Monitoring via a Node.js web application
###Features
- Start/End/Decision/Parallel/Service/Human Task
- Human Task Management
- Process Definition Management and Visualization
- Process Instance Management and Visualization
###Get Started
npm install process-engine
var ProcessEngine = require('process-engine');
// Create a process engine object
var processEngine = ProcessEngine.create();
var simpleDefinition = {
name: 'simple process',
tasks: {
start: {type: 'start'},
'service1': {type: 'service', action: function (variables, complete) {
console.log('do work');
complete();
}
},
end: {type: 'end'}
},
flows: [
{from: 'start', to: 'service1'},
{from: 'service1', to: 'end'}
]
};
// Create process instance from the above process definition
var processDefinition = processEngine.importProcessDefinition(simpleDefinition);
var processInstance = processEngine.createProcessInstance(processDefinition);
// Start the execution of the process instance
processInstance.start();
See examples/tests for all usage that process engine supports
###API
ProcessEngine
importProcessDefinition(definition)
: Create a new process definition based ondefinition
objectcreateProcessDefinition(name)
: Create an empty process definition withname
loadProcessDefinition(id)
: Load a process definition byid
queryProcessDefinition(conditions, options)
: Query process definitions by conditions and optionscreateProcessInstance(def)
: Create a new process instance with definitiondef
loadProcessInstance(id)
: Load a process instance byid
queryProcessInstance(conditions)
: Query process instances by conditionscompleteTask(processId, taskId, variables)
: Complete a task withprocessId
,taskId
,variables
ProcessInstance
is a Node event emitter.Events
before
: emitted before each task is executedafter
: emitted after each task is executedend
: emitted when the whole process instance is ended
start(variables)
: Start the process instance with givenvariables
getNode(taskName)
: Get the runtime node withtaskName
HumanTaskService
complete(taskId, variables)
: Complete the human tasktaskId
withvariables
claim(taskId, user)
: Claim the human tasktaskId
with Useruser
startWorking(taskId)
: Start to work on the human tasktaskId
query(conditions)
: Query the human tasks byconditions
###UI
process-engine.js contains a Node.js web application to manage the process instances and human task list.
- Go to
ui
folder - Run
npm install
- Run
bower install
- Run
npm install -g nodemon
- Run
brunch watch --server
to launch the server - Open
http://localhost:3000/#/definitions
in your browser
###Development
- Test Runner:
npm install -g mocha
- Front End Package Manager:
npm install -g bower
- Front End Build:
npm install -g brunch
- Code Coverage:
npm install -g istanbul
###Roadmap
- Planned
- Human Task Form Builder
- User Management Service
- Performance Benchmark
- Future
- Message/Timer Event Support
- Separate Running and Histronic Process Instances into different collections
- Sub Process
- BPMN 2.0 XML Import/Export