Business Key no longer required to be unique?

I am using Flowable 5 and the Javadocs (http://www.flowable.org/docs/javadocs-5/index.html) for FormService.submitStartFormData state:

Note that a business key MUST be unique for the given process definition.

However, I was able to create a new process instance with that method for the same process definition with the same business key. I am using MySQL as my database and querying the ACT_HI_PROCINST table returns:

±------±--------------±--------------±-----------------+
| id_ | proc_inst_id_ | business_key_ | proc_def_id_ |
±------±--------------±--------------±-----------------+
| 47406 | 47406 | A1234 | TestProcess:1:8 |
| 47435 | 47435 | A1234 | TestProcess:1:8 |
±------±--------------±--------------±-----------------+

I did some digging and it appears the SQL script for MySQL had a unique index for this column changed to not be unique as part of ACT-1860:

commit f091c463439d1e648604de9984d03b34fb784c61
Author: Joram Barrez
Date: Thu Nov 21 09:16:45 2013 +0100

ACT-1860: Remove unique constraint on business key

But the docs continue to say it must be unique. Was there supposed to be a check in the code to prevent duplicate business keys? Or are the docs in error and business key no longer must be unique?

I have not tried this with Flowable 6, but the docs still say the same thing that business key must be unique for a given process definition.

Thanks,

Kevin

1 Like

The javadocs are wrong, the business key should not be unique anymore. The javadoc has been updated here: https://github.com/flowable/flowable-engine/commit/fde36c8dd68ae6d674dbcc15a97c4f797d381935

Of course, if you want to have the same behaviour, you can always add a unique index on the table yourself (which was the old implementation).

I think the unique is need, at least in my case. We use bussiness key as a mechanism to keep idempotent when start porcess instance. In some system it called “correlation id”. I hope it can add back to flowable, or give us other way to achive idempotent, thanks.

Hi,

You can modify DB schema and add unique constraint to your solution.

Regards
Martin