Thursday, January 11, 2018

Flowable workflow engine



I am still looking into workflow engine, and this blog is about open source Flowable. Flowable is a fork of Activiti (registered trademark of Alfresco), its process engine allows you to deploy BPMN 2.0 process definitions (an industry XML standard for defining processes), creating process instances of those process definitions, running queries, accessing active or historical process instances and related data, plus much more.

Installation



flowable-idm is web application to manager users, it is the identity service used in the flowable eco-system. flowable-modeler is a web application that you can use to define process, form and deploy it as an app. flowablw-task is a web-application in which you can launch processed defined and published in flowable-modeler.

The default user/pass is admin/test.
   

  •  I use MySql database. To config Flowable to use MySql, create file under tomcat/lib with the content:


datasource.driver=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://192.168.33.10:3306/Flowable
datasource.username=root
datasource.password=mysql

  • Put MySql JDBC jar under tomcat/lib
  • Create a database Flowable in mysql

Now you can start up Flowable. Upon starting, Flowable will auto create tables in the database.

Usage





This processes uses 3 forms. flowable-modeler doesn’t support importing forms, I followed the form definition files in https://github.com/flowable/flowable-engine/tree/master/modules/flowable-engine/src/test/resources/org/flowable/examples/taskforms and created the 3 forms manually. 





Edit 3 activities of the process, “start event”, “Handle vacation request” user task and “Adjust vacation request” user task, make them reference the above 3 forms respectively, and remove “form key”.



Check out “form properties”, here you can define form fields as workflow variables, which you can use throughout the workflow process:


For example, in the “approveForm”, we can use expression ${vacationMotivation} to access workflow variable which comes from a field in “requestForm”. Flowable uses UEL for expression-resolving. UEL stands for Unified Expression Language and is part of the EE6 specification. Flowable uses an open source beckchr/juel (which hasn’t been updated for several years now) to parse expressions.


In the “Handle vacation request” activity, add “admin” into assignment, so later when launch the process, the current user admin has the privilege to act on the vacation request:







The form definition is stored as a blob in table ACT_FO_FORM_RESOURCE, the process definition is also stored as a blog in table ACT_GE_BYTEARRAY.


Now you’ve defined the process and forms, you can deploy them in “Apps” tab. Create an app and add the process into it and publish it:


Access localhost:8080/flowable-task, and you can launch the previous published app. The process starts with the requestForm


After filling in the form, click “start process”, and get:


Click on “handle vacation request” and get:


Click “claim” and get to the “approveForm”:



Click on “complete”, according the process definition, it will take us to “adjustRequestForm”:




You can export an app definition into a zip file which thankfully contains the form definition. If you import an app definition, flowable will create the process and form definitions.



This simple example has given me some idea on Flowable engine. Its process and form designer in flowable-modeler are not very user friendly, and I am not sure if it is able to support the complex business process that I need to support (judging by the table models, I doubt it can). The user interface in the launched app is not very intuitive.

No comments:

Post a Comment