Data Index Quarkus extensions
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 workflow instances.
The example described in this document is based on the serverless-workflow-timeouts_showcase_embedded
example application.
Overview
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 full 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)
-
kogito-addons-quarkus-data-index-postgresql
With the same purpose, the Quarkus Data Index persistence extension can be added to any workflow application and incorporates only the Data Index indexation and data persistence functionality into the same application without needing an external Data Index service to do that. These extensions are distributed as addons ready to work with different types of persistence:
-
kogito-addons-quarkus-data-index-persistence-postgresql
In this case to interact with that data and related runtimes using GraphQL you will need an external Data Index service that makes that endpoint available.
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
or kogito-addons-quarkus-data-index-persistence
addons is added to a workflow, it incorporates the functionality to index and store the workflow data. In case of the kogito-addons-quarkus-data-index
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.
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 kogito-addons-quarkus-data-index
or kogito-addons-quarkus-data-index-persistence
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.
Only when any of the kogito-addons-quarkus-data-index
addons is added:
-
A new GraphQL endpoint is added to perform queries and management operations when
kogito-addons-quarkus-data-index
is added
Adding Data Index extension to a workflow application
You can add the Data Index quarkus extension as an addon:
-
Your workflow is running and has persistence enabled.
-
Data Index is using the same datasource to store indexed data
For more information about creating a workflow, see Creating your first workflow. You also can find more details about enabling persistence in Running a workflow using PostgreSQL
-
Add the
kogito-addons-quarkus-data-index
extension to your Quarkus Workflow Project using any of the following alternatives:<dependency> <groupId>org.kie</groupId> <artifactId>kogito-addons-quarkus-data-index-postgresql</artifactId> </dependency>
mvn quarkus:add-extension -Dextensions="kogito-addons-quarkus-data-index-postgresql"
quarkus extension add kogito-addons-quarkus-data-index-postgresql
-
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 inapplication.properties
filequarkus.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 quarkus.kogito.devservices.enabled
tofalse
in theapplication.properties
file.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
application.properties
file ofserverless-timeouts_showcase_embedded
example application.
Adding Data Index persistence extension to a workflow application
You can add the Data Index persistence quarkus extension as an addon:
-
Your workflow is running and has persistence enabled
-
Data Index is using the same datasource to store indexed data
For more information about creating a workflow, see Creating your first workflow. You also can find more details about enabling persistence in Running a workflow using PostgreSQL
-
Add the
kogito-addons-quarkus-data-index-persistence
extension to your Quarkus Workflow Project using any of the following alternatives:<dependency> <groupId>org.kie</groupId> <artifactId>kogito-addons-quarkus-data-index-persistence-postgresql</artifactId> </dependency>
mvn quarkus:add-extension -Dextensions="kogito-addons-quarkus-data-index-persistence-postgresql"
quarkus extension add kogito-addons-quarkus-data-index-persistence-postgresql
-
Add the following configurations to the
application.properties
file of your project.
application.properties
filequarkus.kogito.devservices.enabled=false (1)
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 quarkus.kogito.devservices.enabled to false in the application.properties file. |
For more information, see serverless-workflow-data-index-persistence-addon-quarkus
example application.
Found an issue?
If you find an issue or any misleading information, please feel free to report it here. We really appreciate it!