Creating solutions that can emit and react to events in real-time is a practice that gets more and more natural as event-driven solutions’ popularity grows. Combining of events and business processes is a way to unlock powerful capabilities in automation solutions.
In this article, we’ll explore how to leverage such capabilities using Kogito-powered automation, Quarkus, and Kafka.
The project that explores this article’s concepts can be found in GitHub: process-service-event-audit-sample.
Why Combine Events and Processes?
Integrating events and processes opens doors to interesting use cases and expansion of business process automation solutions:
Process Monitoring: By emitting events at various stages of a process, you can create real-time dashboards and monitor process execution as it happens.
To learn about the benefits and how to combine cloud-native process automation with process mining, check this article.
Auditability: Maintaining a complete audit trail for compliance is made easier through detailed event logs that record every significant process change.
Event-based Integration: Trigger actions based on events in a decoupled fashion, delivering loosely coupled, scalable microservices.
Facilitate Analysis: Enable external consumption of the changes in a process, through the events. With that, spot bottlenecks and find ways to optimize processes.
We will explore the events add-on through a mix of concepts explanations and practical execution insights.
This article focuses on the add-on capabilities. Knowledge about usage of message events in process design for interacting with events will be covered on a separate post.
The use case is based on a basic process for approval of credit card applications:

Project configurations
The Events and Processes Add-On (org.kie:kie-addons-quarkus-events-process) is an optional component that can expand the capabilities of a process service. With it, services can emit events associated with state transitions in process elements. Architects can design solutions that consume such events to enable real-time monitoring, auditing, and integration with external microservices.
Technologies used in this exploration: JDK 17, Apache Maven 3.9.6, Quarkus 3.8.4, local Kafka broker (how to), and IBM Business Automation Manager Open Editions 9.1.0 (download).
To enable automatically publishing of events in Quarkus-based process service we need the to set the right dependencies and Kafka configurations:
pom.xml:
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-events-process</artifactId>
<version>9.1.0-ibm-0001</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka
</artifactId>
</dependency>
application.properties:
# Kafka broker URL
kafka.bootstrap.servers=localhost:9092
# Process Instance Events
mp.messaging.outgoing.kogito-processinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-processinstances-events.topic=kogito-processinstances-events
mp.messaging.outgoing.kogito-processinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
# User Task Events
mp.messaging.outgoing.kogito-usertaskinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events
mp.messaging.outgoing.kogito-usertaskinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
Optionally, it’s possible disable specific event channels. To do so, use the following properties:
kogito.events.usertasks.enabled=false
kogito.events.variables.enabled=false
Practical Exploration: Process Events Add-on
The Business Process
Let’s take a closer look at the BPMN implementation of the credit card application approval process.

The two main paths of the flow, mainly determined by automated decisions (Credit Card Eligibility, DMN), are:
- Automatic: End-to-end execution, no need of human intervention.
- Expert review required: New task is assigned to a particular user, or group of users. The task goes through different stages, until its completion. The outcome defines the further processing and flow completion.
Note: To explore the process, use either the KIE Sandbox or clone and explore the project in VSCode using the IBM BAMOE Developer Tools extension.
The multiple state changes throughout the process execution can be tracked using the events automatically and transparently published by the add-on. It’s a clean approach for reacting and taking action based on changes in state of processes, user tasks, and process variables.
About the Topics
These are the main topics holding events of state changes in a process service:
| kogito-processdefinitions-events | For events related to process definitions, including metadata and node structures. Capturing and tracking the definition and version of processes. |
| kogito-processinstances-events | For events related to the lifecycle of process instances. Includes events for node activations, state changes, and variable updates. |
| kogito-usertaskinstances-events | For events related to user tasks within process instances. Includes task state changes and variable updates resulting from user tasks interaction. |
Next, let’s learn more details about each of these topics and the events data.
About the Events
Standards simplify the usage and consumption of events. The events published by the add-on are structured following the CloudEvents specification.
Here’s a summary of the common fields across the different types of events of the add-on:
| specversion | Version of CloudEvents specification |
| id | Unique event’s identifier. |
| source | Where the event comes from. |
| type | The type of event. |
| time | When the event occurred. |
| data | The details of that event. This will change for the different types of event and associated info. |
Now let’s cover the details of the main types of events that happens throughout a process execution: process instance events, user tasks events and variable events.
Process Instance Events
New events are published when a process instance is created, updated, or completed. These events’ data can be used for generating insights about the lifecycle and overall process instances execution.
Here’s an example with the event’s data published when a new process instance is started for the process with ID “credit-card-application“:
{
"id": "df900d05-0641-4063-9e37-3e3648465e44",
"source": "http://localhost:8080/ccapplicationapproval",
"type": "ProcessInstanceStateDataEvent",
"time": "2024-07-17T17:25:21.93199-03:00",
"data": {
"eventDate": "2024-07-17T17:25:21.931-03:00",
"eventUser": null,
"eventType": 1,
"processId": "ccapplicationapproval",
"processVersion": "1.0",
"processType": "BPMN",
"processInstanceId": "b2b79a3e-ba43-49a5-9c10-fe81bb50c04a",
"businessKey": null,
"processName": "ccapplicationapproval",
"parentInstanceId": null,
"rootProcessId": null,
"rootProcessInstanceId": null,
"state": 1,
"roles": null,
"slaDueDate": null
}
}
The fields which are null in the example above, are optional configurations not used in the example process used.
User Task Events
User task events are published for the following human task operations: create, update, complete, and assign. You can use these events to track user task progress, performance, and cycles. The example below shows an event published when the user “jdoe” completes the task “reviewApplication” in the process instance with ID “b2b79a3e-ba43-49a5-9c10-fe81bb50c04a”:
Process Variable Events
Events are published for process variable creation, updates, or deletes. Keep track of data changes and integrate with external solutions for enabling detailed audit logs.
The following event data is published when the “approval” variable is assigned the value “Approved,” in the process instance with ID “b2b79a3e-ba43-49a5-9c10-fe81bb50c04a”:
{
"data": {
"eventDate": "2024-07-17T17:28:42.746-03:00",
"eventUser": null,
"processId": "ccapplicationapproval",
"processVersion": "1.0",
"processInstanceId": "b2b79a3e-ba43-49a5-9c10-fe81bb50c04a",
"nodeContainerDefinitionId": null,
"nodeContainerInstanceId": null,
"variableId": "approval",
"variableName": "approval",
"variableValue": "Approved"
},
"kogitoprocinstanceid": "b2b79a3e-ba43-49a5-9c10-fe81bb50c04a",
"kogitoprocid": "ccapplicationapproval",
"kogitoaddons": "source-files,process-management,process-svg",
"kogitoprocversion": "1.0",
"kogitoprocist": "1",
"kogitoproctype": "BPMN",
"kogitovariablename": "approval"
}
Process Definition Event
When the application starts, events are published for the existing process definitions. For example:
{
"id": "df9d0498-e5ca-4cef-b1ec-5c795cb2efa9",
"source": "http://localhost:8080/ccapplicationapproval",
"type": "ProcessDefinitionEvent",
"time": "2024-07-17T17:22:40.107127-03:00",
"data": {
"id": "ccapplicationapproval",
"name": "ccapplicationapproval",
"version": "1.0",
"type": "BPMN",
"addons": ["source-files", "process-management", "process-svg"],
"endpoint": "http://localhost:8080/ccapplicationapproval",
"metadata": {
"TargetNamespace": "http://www.omg.org/bpmn20"
},
"nodes": [/* node details omitted for brevity */]
}
}
Execution results and considerations
Let’s take a closer look, at the behavior captured through events throughout the execution of the following process instance:

The execution of the process instance above, have these key stages:
- User applies for credit card approval, starting a new process instance;
- Application cannot be automatically completed, and is sent to manual review from bank analyst. At this point, a new user task is now available for execution;
- The user claims the task;
- The user completes the task by informing the evaluation outcome: “Approved”.
- The process moves forward, cc details are generated and the process ends.
Here’s an overall representation of the events that are published by the add-on in our service:

When tracked since the moment the process service (Quarkus application) is bootstrapped, going through the execution of the process instance up until completion, several are most of the events observed.
1. Application Start
As the application starts, a new event registers the process definitions. In this example, a ProcessDefinitionEvent brings information about the BPMN process.
| # | Action | Event Type |
|---|---|---|
| 1 | Process definition registered | ProcessDefinitionEvent |
2. New Process Instance
When a new instance is created, a series of events are published, as the nodes execute as defined, until the process reaches the next wait state (user task).
| # | Action | Event Type |
|---|---|---|
| 1 | Process instance created | ProcessInstanceStateDataEvent |
| 2 | Start node | ProcessInstanceNodeDataEvent |
| 3 | Variable initialization | ProcessInstanceVariableDataEvent |
| 4 | Script task execution (Log application received) | ProcessInstanceNodeDataEvent |
| 5 | Decision task execution (Credit Card Eligibility) | ProcessInstanceNodeDataEvent |
| 6 | Variable update (approval) | ProcessInstanceVariableDataEvent |
| 7 | Gateway (Split) | ProcessInstanceNodeDataEvent |
| 8 | User task ready (Review Application) | UserTaskInstanceStateDataEvent |
3. User Task Execution
One user task can result in multiple interactions and updates. In this example, the user claims and completes the task with an update to one of the process variables. The events published were:
| # | Action | Event Type |
|---|---|---|
| 9 | User task assignment | UserTaskInstanceAssignmentDataEvent |
| 10 | User task claim | UserTaskInstanceStateDataEvent |
| 11 | User task variable update | UserTaskInstanceVariableDataEvent |
| 12 | User task completion | UserTaskInstanceStateDataEvent |
| 13 | Process variable update (approval) | ProcessInstanceVariableDataEvent |
4. Process Continues After User Task
The process moves forward after the user task is completed, and the tasks are executed until it reaches the end event.
| # | Action | Event Type |
|---|---|---|
| 14 | Gateway (Split) | ProcessInstanceNodeDataEvent |
| 15 | Service task execution (Generate CC Details) | ProcessInstanceNodeDataEvent |
| 16 | Variable update from service (creditCard) | ProcessInstanceVariableDataEvent |
| 17 | End node (Approved) | ProcessInstanceNodeDataEvent |
| 18 | Process instance completion | ProcessInstanceStateDataEvent |
You can find code examples of all events data mentioned in this section, on the sample projects file: events-examples.md.
Final thoughts
When designing solutions with event-driven capabilities such as the one we explored, remember to evaluate and define how the organization should handle the new characteristics of the solution, for example:
Security and Privacy
When transmitting sensitive data, explore the recommended ways to securing data and integration with your events platform.
High events volume
Be prepared to handle high volumes of events, especially for frequently executed processes. Work on assuring proper scaling and event buffering mechanisms in the Kafka environment.
Event Retention Policy
Storing events for long periods of time requires more storage resources, which can directly impacts the final cost. Adjusting event retention policies can give you a better control of storage costs.
Enabling events for kogito-powered process services using the process events add-on, is a powerful way to increase transparency in our process automation solutions.
Additional Resources
- Project sample is available on GitHub: process-service-event-audit-sample.
- Explore process automation powered by Kogito with IBM Business Automation Manager Open Edition 9.1. Download it from IBM Open Editions Developer Program, free of charge. More details about the release, including tech preview limitations are available on the official documentation.
- We explored the current version of the add-on, as of July 2024. For additional information on prior versions of the add-on, check out the article available on KIE Blog: Kogito Process Eventing Add-Ons