What's the best practice to move a BPMN process instance to the next step with kafka event?

Hi team,

I have a simple BPMN workflow shown below.

Currently we use several REST API to interact with this BPMN workflow. For example:

  1. My first REST API will find the process definition first and then start a new process instance
  2. The second REST API will use runtime service to find the process instance, and then use runtime service to trigger the triggerable service task.
  3. The third REST API is similar to the #2, but it will use task service to complete the user task.

External services and apps will use those REST APIs to interact with the BPMN workflow. However, those REST calls will create hard dependency.

I’m trying to deprecate those REST APIs and use kafka event to interact with BPMN workflow. I know there is a Event registry Start event can start a process instance with kafka event. But how can I trigger a triggerable service task and complete user tasks with kafka event?

Hey @marshallz,

Apart from the “Event registry start” we have “Send event” and “Send and receive events” that can be used to send an event and send and receive an event. These tasks can also use variables from the process instance for their correlation.

In theory with this your other application does not need to know anything about the process instances. They can communicate via some correlation parameter in the events. e.g. some business related ID.

You can read more about the event and channel concepts in Introducing Events and Channels | Flowable Enterprise Documentation.

Hope this helps,
Filip

Thanks for answering my question. However, I’m still confused.

For the user task step in my BPMN workflow, my use case likes this:

  1. The user clicks the “complete” button from a front end tool
  2. A backend service handles the request and send a kafka event to notify this step is completed.
  3. The BPMN workflow should listen to the event and complete the user task and move to end event.

So instead of using the user task, should I use “Receive event task” so that I can configure the inbound event and channel to the kafka event?

Indeed, you can use a “Received event task” instead of the user task and the engine will automatically handle this once the kafka event comes.

Hi filiphr,

Is there a way to keep using the “User task” and complete it with kafka event? The little user task icon clearly tells our user that this is human work. The “Received event task” works in our use case. But its icon has less meaning to our customer.

Hey @marshallz,

What are you using to show this to your customers? In the end the UI is just that, a UI, depending on what you use for this, you can use different type of icon for this particular “Receive event ask”.

If you can’t you would need to find some other alternative mechanism. You could implement your own Kafka listener that will receive the event and complete the task with code.

Cheers,
Filip