Getting Started with CockroachDB and Flowable

Getting Started with CockroachDB and Flowable

Last week, our friends at Flowable released Flowable 6.4.2, which officially adds support for CockroachDB. Flowable provides a workflow and Business Process Management (BPM) platform for developers, system admins and business users, and now integrates with CockroachDB in just a few steps, thanks to a recent collaboration. Cockroach Labs and Flowable engineers have been teaming up since the early stages of CockroachDB because it makes deploying Flowable that much easier. Plus, as they write in their blog

“What makes CockroachDB very interesting for Flowable is that it’s scalable and distributed database... In the world of processes and cases, atomicity is utmost importance, as data correctness is sacred.”

In their recent blog post about the integration, they show how to get started with running the Flowable engines on top of CockroachDB. We've replicated the steps below so you can get started: 

Step 1: Start CockroachDB

Download the CockroachDB binaries. Start it in a terminal by executing

./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: Create the project

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















This adds: 

    • The Flowable Spring Boot starter dependency. This will automatically create all Flowable engines (bpmn / cmmn / dmn) using the CockroachDB (CRDB) datasource.
    • The PostgreSQL jdbc driver. CRDB is compatible with PostgreSQL (read about that in detail here), which makes it easy to reuse a plethora of tools out there.
    • The Spring Boot web starter that we need to craft the REST endpoint

Step 3: Configure the application

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




Step 4: Start 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: Run 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


Go ahead and query the database using any SQL tool to verify the data is in fact there. You’ll be able to validate that using CockroachDB with Flowable is exactly the same as running it against any other relational database.