Data Index Quarkus extension
This document describes how you add the Data Index features to your workflow. You simply need to add the Data Index extension to the workflow and
the related data will be collected and stored in the database, enabling the GraphQL endpoint to execute queries and perform management operations over the process instances.
The example described in this document is based on the
serverless-workflow-timeouts_showcase_embedded example application.
The Data Index service has been designed to store and manage data from different workflow instances. Communication with the service is through events that contain the workflows related data and the service is responsible for storing them and exposing a GraphQL endpoint to allow queries and maintenance operations on the different workflow instances.
In specific use cases, to avoid deploying the service separately, it could be useful to have the indexing functionality and the query capabilities embedded in the same application. For this purpose, the Quarkus Data Index extension can be added to any workflow application and incorporates the Data Index functionality into the same application without needing an external Data Index service. These extensions are distributed as addons ready to work with different types of persistence:
kogito-addons-quarkus-data-index-inmemory (inmemory PostgreSQL)
The Data Index extensions are provided as addons for each kind of supported persistence relying on the Quarkus extensions mechanism.
Once one of these
kogito-addons-quarkus-data-index addons is added to a workflow, it incorporates the functionality to index and store the workflow data and also incorporates the GraphQL endpoint to perform queries and management operations.
In the same way as the Data Index service, there is a specific addon for each type of persistence you want to work with. Currently, you can find Data Index addons for: PostgreSQL, Infinispan, and MongoDB
The Data Index addon distribution added to the workflow must match the workflow’s persistence type regarding the indexed data, which can be stored in the same database. The addon will share the data source used by the workflow where it is added, and it will create separate tables for that purpose.
When any of the Data Index addons is added:
The communication with the workflow is direct, the workflow data is not transmitted or consumed through events, they are stored directly in the configured database. There is no need to configure the events connection for this purpose.
A new GraphQL endpoint is added to perform queries and management operations
You can add the Data Index quarkus extension as an addon:
Your workflow is running and has persistence enabled.
Add the required Data Index addon dependencies to the
pom.xmlfile of your workflow:Add Data Index Addon dependencies to
<dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-addons-quarkus-data-index-postgresql</artifactId> </dependency>
Configure the Data Index Addon properties.
Prepare the workflow to run in dev mode, avoid starting the Data Index Quarkus Dev service, and specify if the GraphQL UI needs to be available.Example adding Data Index addon properties in
quarkus.kogito.devservices.enabled=false (1) quarkus.kogito.data-index.graphql.ui.always-include=true (2)
1 By default, when a workflow is running in dev mode, automatically a Data Index Dev Service is started and a temporary dev service Database is created. When adding the addon to the workflow, you need to disable it by setting
2 The addon allows to expose a simple UI to interact with the GraphQL endpoint, it only will be available when this property is set to
true, and it will be placed in '<applicationURL>/graphql-ui/`
For more information, see
If you find an issue or any misleading information, please feel free to report it here. We really appreciate it!