Blog Posts BPMN CMMN DMN Execution Methodology

Getting Started with Flowable and CockroachDB

Blog: Flowable Blog

In Flowable 6.4.2, support for CockroachDB was added. We’ve sat together with the engineers from Cockroach Labs (the company behind CockroachDB) to make sure we’ve got the details right and to exchange feedback both ways.

After all, CockroachDB (called CRDB in next paragraphs) is not a ‘regular database’. According to it’s Github page, it’s a cloud-native SQL database for building global, scalable cloud services that survive disasters. It is a distributed SQL database built on a transactional and strongly-consistent key-value store. It scales horizontally; survives disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention.

What makes CRDB very interesting for Flowable is that it’s scalable and distributed database (simply add more nodes to the cluster to cope with more load or store data closer to where it is used) that is fully ACID transactional. In the world of processes and cases, atomicity is utmost importance, as data correctness is sacred.

Furthermore, it also means we can reuse all the existing code in the engines that’s been there for many years and which is battle-hardened by being used by many companies all over the world.

Let’s show how to get started with running the Flowable engines on top of CockroachDB. To make things a bit more interesting, let’s build a simple Spring Boot application that starts a process instance when a REST endpoint is hit.

(Note: obviously the CRDB integration also works in a non-Spring setup)

Step 1: Start CRDB

Download Cockroach from its website:

In a terminal, to start it, execute

./cockroach start --insecure --host=localhost

Note that this is a simple (non-production) setup with only one node in insecure mode. See the docs for other ways of running it, including clustered.

We need a database and user to connect from our application. From the terminal, execute following commands which will create a flowable database and a flowable user.

./cockroach sql --insecure -e 'CREATE DATABASE flowable'
./cockroach sql --insecure -e 'CREATE USER flowable'
./cockroach sql --insecure -e 'GRANT ALL ON DATABASE flowable to flowable'

Step 2: Creating the project

Create a new Spring Boot application (e.g. by going to and generating an empty project) and add the following dependencies:


We’ve added

Step 2: Configuring the application

Flowable needs to know how to connect to the database. Add an file to the resources:


Step 3: The application

The application is a simple Spring Boot application. It has a RestController that has one method that starts a process instance (the process definition is actually in the processes folder of the resources and it automatically picked up).

The ProcessEngine and its services are created automatically and configured to use the CRDB database. As shown in the example below, they are automatically injected in the controller:

public class Application {

public static void main(String[] args) {, args);

class MyRestController {

private RuntimeService runtimeService;
private TaskService taskService;

public MyRestController(final RuntimeService runtimeService, final TaskService taskService) {
this.runtimeService = runtimeService;
this.taskService = taskService;

public void startProcessInstance() {

System.out.println("Number of tasks created: " + taskService.createTaskQuery().count());



Step 4: Running it

After starting the application (from your IDE or terminal), the REST endpoint can now be called:

curl http://localhost:8080/start

which will output

Number of tasks created: 1
Number of tasks created: 2
Number of tasks created: 3

which proves it works (you can query the database using any SQL tool to verify the data is in fact there) and demonstrates that using CockroachDB with Flowable is exactly the same as running it against any other relational database.

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples