Flowable Notes for Beginners

Flowable Notes for Beginners



1. Flowable is a set of process and tasks inside it.

Example snippet (as per bpmn20.xml):

Below snippet is only for understanding on how the process and tasks will be created in flowable for any bpmn process.


  • couponupload is process id/key created to upload the coupons for a particular shop.
  • This process will have set of tasks in order to complete the whole process, here totally 2 process, one is store already partnered or not and whether the category already available or not.

<process id="couponupload" name="Coupon Upload BPMN Process" isExecutable="true">
<userTask id="store-already-partnered" name="Check whether the store is already partnered or not" flowable:assignee="${ storeName }" flowable:candidateGroups="InternalMaintenanceTeam" flowable:dueDate="${ storeCreationDueDate }">
<modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>

<userTask id="category-already-available" name="Check whether the particular shops category is available or not" flowable:assignee="${ categoryName }" flowable:candidateGroups="InternalMaintenanceTeam">
<modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>



2. Installing Flowable and configuring with Apache Tomcat

You have to download flowable-6.4.0(latest while writing this article) and download the apache tomcat, then move all the below five war files to webapps then do tomcat restart for the deployments.

  1. flowable-admin.war
  2. flowable-idm.war
  3. flowable-modeler.war
  4. flowable-rest.war
  5. flowable-task.war

Then you will be able to see the list of flowable wars deployed in the manager of apache tomcat in this url

Url to access:

Default username and password:
username: admin
password: test

Upload your bpmn20.xml file in flowable-modeler, probably in this page http://localhost:8080/flowable-modeler


3. RuntimeService is a class available to start bpmn process.

private RuntimeService runtimeService;


Here RuntimeService is autowired and started the flowable process using startProcessInstanceByKey method,


Note: couponupload is the process id mentioned in the xml above(or the Model key as per the flowable diagram created, which looks similar to the below popup), processMeta can be passed to process as maps.



4. TaskService is also a class available in flowable to initiate / play / work around with the flowable tasks.

private TaskService taskService;



Fetching the list of tasks for a particular assignee:

// this just fetches the list of tasks by the assignee name.

List<Task> tasks = taskService.createTaskQuery().taskAssignee(assignee).orderByDueDateNullsLast().desc().list();



5. Deleting a process with process_id

Process_id can be taken from the “act_ru_task” table “PROC_INST_ID_” column

private RuntimeService runtimeService;

runtimeService.deleteProcessInstance(processInstanceId, "test");


@DeleteMapping(value = "/process/{processInstanceId}")
public boolean deleteLmImplementationByProcess(@PathVariable("processInstanceId") String processInstanceId) {

runtimeService.deleteProcessInstance(processInstanceId, "test");

return true;




6. How to get the process varialbles saved back from flowable tables

//Here executionid, is the task key id.

Map<String, Object> processVariables = runtimeService.getVariables(task.getExecutionId());

String taskDefKey = StringUtils.trimToEmpty(task.getTaskDefinitionKey());

// this returns the coupons process variables saved.




7. How to create a diagram in flowable ?

Flowable Modeler can be used to create any new BPMN process flowable diagrams. Please make sure flowable installation is completed properly before trying to open the below link,


Process -> Create Process


We have different flows like manual task, end event, choice gateway, timer trigger, intermediate events etc.

Along with that you will also find a different tasks like user task/Script task/Business rule task/Receive task/Manual task/Mail task/Camel task/Http task/Mule task/Send task/Shell task/Decision task.

Mainly we need to fill the fields for every tasks like id(unique to identity and process the task), assignee to take the flow properly with respect to the allowed flowable users, Delegate expression like sending/notifying some updates to involved groups and category(this one can be reused to identify if different flows are using the same functionality).



8. How to configure a Delegate services in Flowable ?

In the flowable, we may require sms/email notifications sometime, this can be configured using JavaDelegate provided in the flowables.

This will be triggered when delegate expression enabled in the BPMN processes.


import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;

public class SMSDelegate implements JavaDelegate {


public void execute(DelegateExecution execution) {
// your business goes here.




9. Working with Execution Listeners:

If you want to listen to some task and do some other task then execution listeners are good option in flowable.


Here in this case smsListener task will be listened here and executes the notify method, so that if anything else needs to be run in parallel with sms tasks then this can be utilized effectively in flowable.


import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

public class SmsListener implements ExecutionListener {

public void notify(DelegateExecution execution) {
// your business goes here

376 total views, 2 views today

About Mirthbees 672 Articles
Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.