5.2. Data Index service
The Data Index service is a dedicated supporting service that stores the data related to the workflow instances and their associated jobs. This service provides a GraphQL endpoint allowing users to query that data.
The Data Index service processes data received through events, which can originate from any workflow or directly from the Job service.
Data Index supports Apache Kafka or Knative Eventing to consume CloudEvents messages from workflows. It indexes and stores this event data in a database, making it accessible through GraphQL. These events provide detailed information about the workflow execution. The Data Index service is central to OpenShift Serverless Logic search, insights, and management capabilities.
The key features of the Data Index service are as follows:
- A flexible data structure
- A distributable, cloud-ready format
- Message-based communication with workflows via Apache Kafka, Knative, and CloudEvents
- A powerful GraphQL-based querying API
When you are using the OpenShift Serverless Operator to deploy workflows, you do not need to manually install or configure the Data Index service. The Operator automatically manages all the necessary configurations for each workflow to connect with it.
5.2.1. GraphQL queries for workflow instances and jobs 링크 복사링크가 클립보드에 복사되었습니다!
To retrieve data about workflow instances and jobs, you can use GraphQL queries.
5.2.1.1. Retrieve data from workflow instances 링크 복사링크가 클립보드에 복사되었습니다!
You can retrieve information about a specific workflow instance by using the following query example:
{
ProcessInstances {
id
processId
state
parentProcessInstanceId
rootProcessId
rootProcessInstanceId
variables
nodes {
id
name
type
}
}
}
5.2.1.2. Retrieve data from jobs 링크 복사링크가 클립보드에 복사되었습니다!
You can retrieve data from a specific job instance by using the following query example:
{
Jobs {
id
status
priority
processId
processInstanceId
executionCounter
}
}
5.2.1.3. Filter query results by using the where parameter 링크 복사링크가 클립보드에 복사되었습니다!
You can filter query results by using the where parameter, allowing multiple combinations based on workflow attributes.
Example query to filter by state
{
ProcessInstances(where: {state: {equal: ACTIVE}}) {
id
processId
processName
start
state
variables
}
}
Example query to filter by ID
{
ProcessInstances(where: {id: {equal: "d43a56b6-fb11-4066-b689-d70386b9a375"}}) {
id
processId
processName
start
state
variables
}
}
By default, filters are combined using the AND Operator. You can modify this behavior by combining filters with the AND or OR operators.
Example query to combine filters with the OR Operator
{
ProcessInstances(where: {or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}) {
id
processId
processName
start
end
state
}
}
Example query to combine filters with the AND and OR Operators
{
ProcessInstances(where: {and: {processId: {equal: "travels"}, or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}}) {
id
processId
processName
start
end
state
}
}
Depending on the attribute type, you can use the following avaialable Operators:
| Attribute type | Available Operators |
|---|---|
| String array |
|
| String |
|
| ID |
|
| Boolean |
|
| Numeric |
|
| Date |
|
5.2.1.4. Sort query results by using the orderBy parameter 링크 복사링크가 클립보드에 복사되었습니다!
You can sort query results based on workflow attributes by using the orderBy parameter. You can also specify the sorting direction in an ascending (ASC) or a descending (DESC) order. Multiple attributes are applied in the order you specified.
Example query to sort by the start time in an ASC order
{
ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}) {
id
processId
processName
start
end
state
}
}
5.2.1.5. Limit the number of results by using the pagination parameter 링크 복사링크가 클립보드에 복사되었습니다!
You can control the number of returned results and specify an offset by using the pagination parameter.
Example query to limit results to 10, starting from offset 0
{
ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}, pagination: {limit: 10, offset: 0}) {
id
processId
processName
start
end
state
}
}