Kogito is an implementation of the CNCF Serverless Workflow Specification.
Currently, Kogito implements the version 0.8 of the specification.
The following table lists the current status of the features as defined by the specification:
Feature | Status |
---|---|
States | 🌓 |
Functions | 🌓 |
Events | 🌓 |
Retries | 🚧 |
Workflow Data | 🌓 |
Expressions | 🌕 |
Error Handling | 🌕 |
Compensation | 🌕 |
Legend:
Symbol | Meaning |
---|---|
🌕 | Fully implemented |
🌓 | Partially implemented |
🚧 | To be implemented |
The sections below describe in detail the current status of the supported features.
State | Status |
---|---|
Event | 🌓 |
Operation | 🌕 |
Switch | 🌕 |
Delay | 🌕 |
Parallel | 🌕 |
Inject | 🌕 |
ForEach | 🌕 |
Callback | 🌕 |
Event state is not supported as starting state if exclusive flag is set to false.
⚠️ Quarkus is the only supported runtime for Kogito Serverless Workflow.
- Event Example
- Operation Example
- Switch, Parallel, and SubFlow Example
- Inject and Switch Example
- Callback Example
Function Type | Status | Obs |
---|---|---|
rest | 🌕 | You can find more details about the Kogito OpenAPI implementation here |
rpc | 🌕 | |
expression | 🌕 | Either jq or jsonpath |
asyncapi | 🚧 | |
graphql | 🚧 | |
odata | 🚧 | |
custom | 🌕 |
Additionally, even though they are not defined in the specification, Kogito also supports sysout
and java
functions.
This function support can be used for debugging reasons:
{
"functions": [
{
"name": "printMessage",
"metadata": {
"type": "sysout"
}
}
]
}
Later in your State definition you can call it with:
{
"states": [
{
"name": "myState",
"type": "operation",
"actions": [
{
"name": "printAction",
"functionRef": {
"refName": "printMessage",
"arguments": {
"message": "."
}
}
}
]
}
]
}
You should see the data output in your console.
Kogito also supports calling Java functions within the maven project which the workflow is defined. You can declare your functions like this:
{
"functions": [
{
"name": "myFunction",
"type": "custom",
"operation": "service:java:com.acme.MyInterfaceOrClass::myMethod"
}
]
}
Your method's interface must receive a Jackson's JsonNode
object and return either void
or another JsonNode
.
For example:
public class MyInterfaceOrClass {
public void myMethod(JsonNode workflowData) {
// do whatever I want with the JsonNode:
// { "workflowdata": {} }
}
public JsonNode myMethod(JsonNode workflowData) {
// do whatever I want with the JsonNode:
// { "workflowdata": {} }
// return the modified content:
return workflowData;
}
}
To call this function within your workflow you can extract the json value you need via a jq
expression or pass it
without any arguments. In this case the whole payload is sent.
For example:
{
"states": [
{
"name": "myState",
"type": "operation",
"actions": [
{
"name": "callJavaFunctionAction",
"functionRef": {
"refName": "myFunction"
}
}
]
}
]
}
Or, if you prefer you can pass only the necessary data:
{
"states": [
{
"name": "myState",
"type": "operation",
"actions": [
{
"name": "callJavaFunctionAction",
"functionRef": {
"refName": "myFunction",
"arguments": {
"data": ".my.path.to.data"
}
}
}
]
}
]
}
- Functions With Quarkus
- Funqy
- The GitHub Showcase
- Greetings Example With Quarkus
- Temperature Conversion Example
Definition | Status | Obs |
---|---|---|
Name | 🌕 | |
Source | 🌕 | |
Type | 🌕 | |
Kind | 🌕 | |
Correlation | 🚧 | |
Metadata | 🌕 | |
Data only | 🌓 | Default is "dataOnly": true . "dataOnly": false is ignored |
Retries hasn't been implemented yet, but it's in our roadmap for the future versions.
Alternatively to retries, you can use our error handling feature.
Data manipulation (transformation) on Kogito is fully implemented and can be used either jq
or jsonpath
. State
and Action data
filtering is also supported.
Kogito supports either jq
or jsonpath
to define workflow expressions. As defined in the specification, jq
is the
default expression language. If you wish to use jsonpath
instead, set the attribute expressionLang
in the workflow
definition:
{
"id": "myworkflow",
"version": "1.0",
"expressionLang": "jsonpath",
"name": "Workflow example",
"description": "An example of how to use workflows"
}
Kogito supports error handling. Find more details about this implementation on our documentation.
Kogito supports workflow compensation as described in the specification.