Duplicate process instances are created

Duplicate process instances are created when we start process instance by key with same payload.

BPMN File: duplicateprocess.bpmn (2.6 KB)

Payload:

{
  "businessKey": "A123",
  "variables": {
    "textMessage": {
      "type": "String",
      "value": "Hello World"
    }
  }
}

If i submit the same request again, it creates duplicate process instances.

How to prevent creating duplicate process instances of same request payload?

They’re not duplicates, they’re 2 different process instances that share the same data. There is no validation done by the engine that would stop an instance from starting based on the data in another. So this is expected behavior.

Yeah i know the behavior. Is there a way to stop creating process instances for same payload?

Like throwing an exception by configuring Event listener in Start event and querying for either businesskey or process variables if already exists?

Yup, any of those options could work - a listener on a star event would do the trick.

1 Like

Thanks @Niall for the suggestions.

@Niall @aravindhrs hello! Tried solution with listener and it failed in concurrent environment.

Second image

Hi,

this post may be of interest, it talks to some process patterns to detect and deal with duplicates…

regards

Rob