Skip to content

Commit 84c3578

Browse files
authored
Merge pull request #83066 from kaldesai/SRVLOGIC-309-Data-Index-service
PR for SRVLOGIC-309: Document "Data Index Service" section in the OSL docs
2 parents 6d21f96 + d79f20d commit 84c3578

File tree

2 files changed

+236
-2
lines changed

2 files changed

+236
-2
lines changed
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
// Module included in the following assemblies:
2+
// * serverless-logic/serverless-logic-supporting-services/serverless-logic-data-index
3+
4+
:_mod-docs-content-type: REFERENCE
5+
[id="serverless-logic-data-index-graphql-queries_{context}"]
6+
= GraphQL queries for workflow instances and jobs
7+
8+
To retrieve data about workflow instances and jobs, you can use GraphQL queries.
9+
10+
[id="serverless-logic-retrieve-data-workflow-instances_{context}"]
11+
== Retrieve data from workflow instances
12+
13+
You can retrieve information about a specific workflow instance by using the following query example:
14+
15+
[source,text]
16+
----
17+
{
18+
ProcessInstances {
19+
id
20+
processId
21+
state
22+
parentProcessInstanceId
23+
rootProcessId
24+
rootProcessInstanceId
25+
variables
26+
nodes {
27+
id
28+
name
29+
type
30+
}
31+
}
32+
}
33+
----
34+
35+
[id="serverless-logic-retrieve-data-jobs_{context}"]
36+
== Retrieve data from jobs
37+
38+
You can retrieve data from a specific job instance by using the following query example:
39+
40+
[source,text]
41+
----
42+
{
43+
Jobs {
44+
id
45+
status
46+
priority
47+
processId
48+
processInstanceId
49+
executionCounter
50+
}
51+
}
52+
----
53+
54+
[id="serverless-logic-filter-query-results_{context}"]
55+
== Filter query results by using the where parameter
56+
57+
You can filter query results by using the `where` parameter, allowing multiple combinations based on workflow attributes.
58+
59+
.Example query to filter by state
60+
[source,text]
61+
----
62+
{
63+
ProcessInstances(where: {state: {equal: ACTIVE}}) {
64+
id
65+
processId
66+
processName
67+
start
68+
state
69+
variables
70+
}
71+
}
72+
----
73+
74+
.Example query to filter by ID
75+
[source,text]
76+
----
77+
{
78+
ProcessInstances(where: {id: {equal: "d43a56b6-fb11-4066-b689-d70386b9a375"}}) {
79+
id
80+
processId
81+
processName
82+
start
83+
state
84+
variables
85+
}
86+
}
87+
----
88+
89+
By default, filters are combined using the AND Operator. You can modify this behavior by combining filters with the AND or OR operators.
90+
91+
.Example query to combine filters with the OR Operator
92+
[source,text]
93+
----
94+
{
95+
ProcessInstances(where: {or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}) {
96+
id
97+
processId
98+
processName
99+
start
100+
end
101+
state
102+
}
103+
}
104+
----
105+
106+
.Example query to combine filters with the AND and OR Operators
107+
[source,text]
108+
----
109+
{
110+
ProcessInstances(where: {and: {processId: {equal: "travels"}, or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}}) {
111+
id
112+
processId
113+
processName
114+
start
115+
end
116+
state
117+
}
118+
}
119+
----
120+
121+
Depending on the attribute type, you can use the following avaialable Operators:
122+
123+
[cols=2*,options="header"]
124+
|===
125+
|Attribute type
126+
|Available Operators
127+
128+
|String array
129+
a|
130+
* `contains`: String
131+
* `containsAll`: Array of strings
132+
* `containsAny`: Array of strings
133+
* `isNull`: Boolean (true or false)
134+
135+
|String
136+
a|
137+
* `in`: Array of strings
138+
* `like`: String
139+
* `isNull`: Boolean (true or false)
140+
* `equal`: String
141+
142+
|ID
143+
a|
144+
* `in`: Array of strings
145+
* `isNull`: Boolean (true or false)
146+
* `equal`: String
147+
148+
|Boolean
149+
a|
150+
* `isNull`: Boolean (true or false)
151+
* `equal`: Boolean (true or false)
152+
153+
|Numeric
154+
a|
155+
* `in`: Array of integers
156+
* `isNull`: Boolean
157+
* `equal`: Integer
158+
* `greaterThan`: Integer
159+
* `greaterThanEqual`: Integer
160+
* `lessThan`: Integer
161+
* `lessThanEqual`: Integer
162+
* `between`: Numeric range
163+
* `from`: Integer
164+
* `to`: Integer
165+
166+
|Date
167+
a|
168+
* `isNull`: Boolean (true or false)
169+
* `equal`: Date time
170+
* `greaterThan`: Date time
171+
* `greaterThanEqual`: Date time
172+
* `lessThan`: Date time
173+
* `lessThanEqual`: Date time
174+
* `between`: Date range
175+
* `from`: Date time
176+
* `to`: Date time
177+
178+
|===
179+
180+
[id="serverless-logic-sort-query-results_{context}"]
181+
== Sort query results by using the orderBy parameter
182+
183+
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.
184+
185+
.Example query to sort by the start time in an `ASC` order
186+
[source,text]
187+
----
188+
{
189+
ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}) {
190+
id
191+
processId
192+
processName
193+
start
194+
end
195+
state
196+
}
197+
}
198+
----
199+
200+
[id="serverless-logic-limits-offset-query-results_{context}"]
201+
== Limit the number of results by using the pagination parameter
202+
203+
You can control the number of returned results and specify an offset by using the `pagination` parameter.
204+
205+
.Example query to limit results to 10, starting from offset 0
206+
[source,text]
207+
----
208+
{
209+
ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}, pagination: {limit: 10, offset: 0}) {
210+
id
211+
processId
212+
processName
213+
start
214+
end
215+
state
216+
}
217+
}
218+
----

serverless-logic/serverless-logic-supporting-services/serverless-logic-data-index.adoc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

9-
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 and modify that data.
9+
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.
1010

11-
//I will include more modules in smaller, incremental PRs to avoid having one large PR. Currently building the directory structure for the OSL content.
11+
The Data Index service processes data received through events, which can originate from any workflow or directly from the Job service.
12+
13+
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 {ServerlessLogicProductName} search, insights, and management capabilities.
14+
15+
The key features of the Data Index service are as follows:
16+
17+
* A flexible data structure
18+
* A distributable, cloud-ready format
19+
* Message-based communication with workflows via Apache Kafka, Knative, and CloudEvents
20+
* A powerful GraphQL-based querying API
21+
22+
[NOTE]
23+
====
24+
When you are using the {ServerlessOperatorName} 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.
25+
====
26+
27+
include::modules/serverless-logic-data-index-graphql-queries.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)