All persistent entities managed by the process engine (Process Instances, Tasks, …) have uniqueIds. These Ids uniquely identify an individual task, process instance, etc. When these entities arepersisted to the database, the ids are used as primary keys in the corresponding database tables.
Out of the box, the process engine provides two Id generator implementations.
The Database Id Generator
The Database Id Generator is implemented using a sequence Generator on top of the ACT_RU_PROPERTY
table.
This id generator is good for debugging and testing since it generates human readable ids.
The Database Id Generator should never be used in production since it cannot handle high levels of concurrency.
The UUID Generator
The StrongUuidGenerator uses a UUID generator which uses the Java UUID Generator (JUG) libraryinternally.
Always use the StrongUuidGenerator for production setups.
In the Camunda BPM Full Distributions, theStrongUuidGenerator is preconfigured and the default Id Generator used by the process engine.
If you use an embedded process engine configuration and configure the process engine using Spring,you need to add the following lines to the Spring configuration to enable theStrongUuidGenerator
:
<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
[...]
<property name="idGenerator">
<bean class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />
</property>
</bean>
Additionally, you need the following maven dependency:
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<scope>provided</scope>
<version>3.1.2</version>
</dependency>
原文: https://docs.camunda.org/manual/7.9/user-guide/process-engine/id-generator/