diff --git a/README.md b/README.md
index 9a9ac63..0edd150 100644
--- a/README.md
+++ b/README.md
@@ -2,22 +2,73 @@
Collection of artifacts to test SonataFlow Use Cases TP2.
-## Deploy Data Index locally
+## Prereqs for all the use cases
-Example of how to deploy Data Index on Kubernetes.
+1. Minikube installed
+
+We recommend that you start Minikube with the following parameters, note that the `registry` addon must be enabled.
+
+```shell
+minikube start --cpus 4 --memory 10240 --addons registry --addons metrics-server --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000"
+```
+
+To verify that the registry addon was property added you can execute this command:
+
+```shell
+minikube addons list | grep registry
+```
+
+```
+| registry | minikube | enabled ✅ | Google |
+| registry-aliases | minikube | disabled | 3rd party (unknown) |
+| registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) |
+```
-### Prereqs
-1. Minikube installed
2. kubectl installed
+3. SonataFlow operator installed if workflows are deployed
+
+To install the operator you can see [SonataFlow Installation](https://sonataflow.org/serverlessworkflow/latest/cloud/operator/install-serverless-operator.html).
+
+## Use cases
+
+This is the list of available use cases:
+
+| Use case | Description |
+|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [Deploy Data Index Locally](#deploy-data-index-locally) | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb
|
+| [Use case 1](#use-case-1) | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb
* The `greeting` workflow (no persistence) configured to register the process events on the Data Index Service. |
+| [Use case 2](#use-case-2) | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb
* The `greeting` workflow (no persistence)
* The `helloworkflow` (no persistence)
* Workflows are configured to register the process events on the Data Index Service. |
+| [Use case 3](#use-case-3) | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb * Jobs Service + postgresdb, configured to send the job events to the Data Index Service.
* The `callbackstatetimeouts` (no persistence) configured to:
- register process events on the Data Index Service
- create timers in the Jobs Service |
+| [Use case 3 persistence](#use-case-3-persistence) **(not working yet)** | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb * Jobs Service + postgresdb, configured to send the job events to the Data Index Service.
* The `callbackstatetimeouts` (with persistence) configured to:
- register process events on the Data Index Service
- create timers in the Jobs Service |
+| [Use case 4](#use-case-4) | This use case deploys:
* PostgreSQL Service
* Data Index Service + postgresdb * Jobs Service + postgresdb, configured to send the job events to the Data Index Service.
* The `greetings` workflow (no persistence)
* The `callbackstatetimeouts` workflow (no persistence)
* The `workflowtimeouts` workflow (no persistence)
* Workflows are configured to register process events on the Data Index Service and create timers on the Jobs Service |
+
+> **NOTE:** To facilitate the switch between use cases, it's strongly recommended to install each use case in a dedicated namespace.
+
+## Deploy Data Index locally
+
+Example of how to deploy Data Index on Kubernetes that uses a Postgresql DB.
+
+> **NOTE:** The workflow related use cases that needs a data index service already includes this step.
+
### Procedure
-Open a terminal and run the following command:
+Open a terminal and run the following commands:
+
+1. Create the namespace:
+
+```shell
+kubectl create namespace data-index-usecase
+```
+
+2. Deploy the Data Index Service:
```shell
-kubectl kustomize dataindex | kubectl apply -f -
+kubectl kustomize infra/dataindex | kubectl apply -f - -n data-index-usecase
+```
+```
configmap/dataindex-properties-hg9ff8bff5 created
secret/postgres-secrets-22tkgc2dt7 created
service/data-index-service-postgresql created
@@ -27,68 +78,654 @@ deployment.apps/data-index-service-postgresql created
deployment.apps/postgres created
```
-This will deploy a Data Index for you in the `default` namespace. Alternatively, you can pass `-n ` to deploy it in a specific namespace.
+This will deploy a Data Index for you in the `data-index-usecase` namespace. (If you don't use a namespace the `default` is used instead)
Data Index will be backed by a Postgres Data Base deployment. **This setup is not intended for production environments** since this simple Postgres Deployment does not scale well. Please see the [Postgres Operator](https://github.com/zalando/postgres-operator) for more information.
+
+To check that the data index is running you can execute this command.
+
+```shell
+kubectl get pod -n data-index-usecase
+```
+
+```
+data-index-service-postgresql-5d76dc4468-69hm6 1/1 Running 0 2m11s
+postgres-7f78499688-j6282 1/1 Running 0 2m11s
+```
+
To access the Data Index, using Minikube you can run:
```shell
-minikube service data-index-service-postgresql --url
+minikube service data-index-service-postgresql --url -n data-index-usecase
```
-The output is the Data Index URL, so you can access the GraphiQL UI.
+Example output:
+```
+http://192.168.49.2:30352
+```
+The output is the Data Index URL, so you can access the GraphiQL UI by using a url like this http://192.168.49.2:30352/grpahiql/ (host and por might be different in your installation.)
For more information about Data Index and this deployment see [Data Index standalone service](https://sonataflow.org/serverlessworkflow/latest/data-index/data-index-service.html) in SonataFlow guides.
-## Deploy the SonataFlow Greeting example
+To execute queries see: [Querying Index Queries](#querying-data-index)
+
+3. Clean the use case:
+
+```shell
+kubectl delete namespace data-index-usecase
+```
+
+## Use case 1
+
+This use case is intended to represent an installation with:
+
+* A singleton Data Index Service with PostgreSQL persistence
+* The `greeting` workflow (no persistence), that is configured to register events to the Data Index Service.
+
+### Procedure
+
+Open a terminal and run the following commands:
+
+1. Create the namespace:
+
+```shell
+kubectl create namespace usecase1
+```
+
+2. Deploy the Data Index Service:
+```shell
+kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase1
+```
+
+```
+configmap/dataindex-properties-hg9ff8bff5 created
+secret/postgres-secrets-22tkgc2dt7 created
+service/data-index-service-postgresql created
+service/postgres created
+persistentvolumeclaim/postgres-pvc created
+deployment.apps/data-index-service-postgresql created
+deployment.apps/postgres created
+
+```
+
+Give some time for the data index to start, you can check that it's running by executing.
+
+```shell
+kubectl get pod -n usecase1
+```
+
+```
+NAME READY STATUS RESTARTS AGE
+data-index-service-postgresql-5d76dc4468-lb259 1/1 Running 0 2m11s
+postgres-7f78499688-lc8n6 1/1 Running 0 2m11s
+```
+
+3. Deploy the workflow:
+
+```shell
+ kubectl kustomize usecases/usecase1 | kubectl apply -f - -n usecase1
+ ```
+
+```
+configmap/greeting-props created
+sonataflow.sonataflow.org/greeting created
+sonataflowplatform.sonataflow.org/sonataflow-platform created
+```
+
+Give some time for the sonataflow operator to build and deploy the workflow.
+To check that the workflow is ready you can use this command.
+
+```shell
+kubectl get workflow -n usecase1
+```
+
+```
+NAME PROFILE VERSION URL READY REASON
+greeting 0.0.1 True
+```
+
+4. Expose the workflow and get the url:
+
+```shell
+kubectl patch svc greeting -p '{"spec": {"type": "NodePort"}}' -n usecase1
+```
+
+```shell
+ minikube service greeting --url -n usecase1
+ ```
+
+5. Create a workflow instance:
+
+You must use the URLs calculated in step 4.
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' http://192.168.49.2:32407/greeting
+```
+
+**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index)
+
+
+6. Clean the use case:
+
+```shell
+kubectl delete namespace usecase1
+```
+
+## Use case 2
+
+This use case is intended to represent an installation with:
+
+* A singleton Data Index Service with PostgreSQL persistence
+* The `greeting` workflow (no persistence)
+* The `helloworkflow` workflow (no persistence)
+* The workflows are configured to register the process events on the Data Index Service.
+
+### Procedure
+
+Open a terminal and run the following commands:
+
+1. Create the namespace:
+
+```shell
+kubectl create namespace usecase2
+```
+
+2. Deploy the Data Index Service:
+```shell
+kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase2
+```
+
+```
+configmap/dataindex-properties-hg9ff8bff5 created
+secret/postgres-secrets-22tkgc2dt7 created
+service/data-index-service-postgresql created
+service/postgres created
+persistentvolumeclaim/postgres-pvc created
+deployment.apps/data-index-service-postgresql created
+deployment.apps/postgres created
+
+```
+
+Give some time for the data index to start, you can check that it's running by executing.
+
+```shell
+kubectl get pod -n usecase2
+```
+
+```
+NAME READY STATUS RESTARTS AGE
+data-index-service-postgresql-5d76dc4468-lb259 1/1 Running 0 2m11s
+postgres-7f78499688-lc8n6 1/1 Running 0 2m11s
+```
+
+3. Deploy the workflows:
+
+```shell
+ kubectl kustomize usecases/usecase2 | kubectl apply -f - -n usecase2
+ ```
+
+```
+configmap/greeting-props created
+configmap/helloworld-props created
+sonataflow.sonataflow.org/greeting created
+sonataflow.sonataflow.org/helloworld created
+sonataflowplatform.sonataflow.org/sonataflow-platform created
+```
+
+Give some time for the sonataflow operator to build and deploy the workflows.
+To check that the workflows are ready you can use this command.
+
+```shell
+kubectl get workflow -n usecase2
+```
+
+```
+NAME PROFILE VERSION URL READY REASON
+greeting 0.0.1 True
+helloworld 0.0.1 True
+```
+
+4. Expose the workflows and get the urls:
+
+```shell
+kubectl patch svc greeting helloworld -p '{"spec": {"type": "NodePort"}}' -n usecase2
+```
+
+```shell
+ minikube service greeting --url -n usecase2
+ ```
+
+```shell
+ minikube service helloworld --url -n usecase2
+ ```
+
+5. Create a workflow instances:
+
+You must use the URLs calculated in step 4.
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' http://192.168.49.2:32407/greeting
+```
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{}' http://192.168.49.2:32327/helloworld
+```
+
+**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index)
+
+6. Clean the use case:
+
+```shell
+kubectl delete namespace usecase2
+```
+
+## Use case 3
+
+This use case is intended to represent an installation with:
+
+* A singleton Data Index Service with PostgreSQL persistence
+* A singleton Jobs Service with PostgreSQL persistence configured to send job status events to the Data Index Service.
+* The `callbackstateworkflow` workflow (no persistence)
+* The workflow is configured to register the process events on the Data Index Service.
+* The workflow is configured to create timers on the Jobs Service.
+
+### Procedure
+
+Open a terminal and run the following commands:
+
+1. Create the namespace:
+
+```shell
+kubectl create namespace usecase3
+```
+
+2. Install the Data Index Service and the Jobs Service:
+
+```shell
+kubectl kustomize infra/dataindex_and_jobservice | kubectl apply -f - -n usecase3
+```
+
+```
+configmap/dataindex-properties-hg9ff8bff5 created
+configmap/jobs-service-properties-9bf9cg9b9f created
+secret/postgres-secrets-22tkgc2dt7 created
+service/data-index-service-postgresql created
+service/jobs-service-postgresql created
+service/postgres created
+persistentvolumeclaim/postgres-pvc created
+deployment.apps/data-index-service-postgresql created
+deployment.apps/jobs-service-postgresql created
+deployment.apps/postgres created
+```
+
+Give some time for the data index and the job service to start, you can check that it's running by executing.
+
+```shell
+kubectl get pod -n usecase3
+```
+
+```
+NAME READY STATUS RESTARTS AGE
+data-index-service-postgresql-69f684d458-scxbr 1/1 Running 0 65s
+jobs-service-postgresql-5c9b74cfc5-qnvkh 1/1 Running 0 65s
+postgres-7f78499688-2dnj5 1/1 Running 0 65s
+```
+
+3. Install the workflow:
+
+```shell
+ kubectl kustomize usecases/usecase3 | kubectl apply -f - -n usecase3
+ ```
+
+```
+configmap/callbackstatetimeouts-props created
+sonataflow.sonataflow.org/callbackstatetimeouts created
+sonataflowplatform.sonataflow.org/sonataflow-platform created
+```
+
+Give some time for the sonataflow operator to build and deploy the workflow.
+To check that the workflow is ready you can use this command.
+
+```shell
+kubectl get workflow -n usecase3
+```
+
+```
+NAME PROFILE VERSION URL READY REASON
+callbackstatetimeouts 0.0.1 True
+```
+
+4. Expose the workflow and get the url:
+
+```shell
+kubectl patch svc callbackstatetimeouts -p '{"spec": {"type": "NodePort"}}' -n usecase3
+```
+
+```shell
+ minikube service callbackstatetimeouts --url -n usecase3
+ ```
+
+5. Create a workflow instance:
+
+You must use the URL calculated in step 4.
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{}' http://192.168.49.2:30707/callbackstatetimeouts
+```
+
+**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index)
+
+6. Clean the use case:
+
+```shell
+kubectl delete namespace usecase3
+```
+
+## Use case 3 persistence
+
+**This use case is not working yet**
+
+This use case is intended to represent an installation with:
+
+* A singleton Data Index Service with PostgreSQL persistence
+* A singleton Jobs Service with PostgreSQL persistence configured to send job status events to the Data Index Service.
+* The `callbackstateworkflow` workflow (with persistence)
+* The workflow is configured to register the process events on the Data Index Service.
+* The workflow is configured to create timers on the Jobs Service.
+
+### Procedure
+
+Open a terminal and run the following commands:
+
+1. Create the namespace:
+
+```shell
+kubectl create namespace usecase3-persistence
+```
+
+2. Install the Data Index Service and the Jobs Service:
+
+```shell
+kubectl kustomize infra/dataindex_and_jobservice | kubectl apply -f - -n usecase3-persistence
+```
+
+```
+configmap/dataindex-properties-hg9ff8bff5 created
+configmap/jobs-service-properties-9bf9cg9b9f created
+secret/postgres-secrets-22tkgc2dt7 created
+service/data-index-service-postgresql created
+service/jobs-service-postgresql created
+service/postgres created
+persistentvolumeclaim/postgres-pvc created
+deployment.apps/data-index-service-postgresql created
+deployment.apps/jobs-service-postgresql created
+deployment.apps/postgres created
+```
+
+Give some time for the data index and the job service to start, you can check that it's running by executing.
+
+```shell
+kubectl get pod -n usecase3-persistence
+```
+
+```
+NAME READY STATUS RESTARTS AGE
+data-index-service-postgresql-69f684d458-scxbr 1/1 Running 0 65s
+jobs-service-postgresql-5c9b74cfc5-qnvkh 1/1 Running 0 65s
+postgres-7f78499688-2dnj5 1/1 Running 0 65s
+```
+
+3. Install the workflow:
+
+```shell
+ kubectl kustomize usecases/usecase3-persistence | kubectl apply -f - -n usecase3-persistence
+ ```
+
+```
+configmap/callbackstatetimeouts-props created
+sonataflow.sonataflow.org/callbackstatetimeouts created
+sonataflowplatform.sonataflow.org/sonataflow-platform created
+```
+
+Give some time for the sonataflow operator to build and deploy the workflow.
+To check that the workflow is ready you can use this command.
+
+```shell
+kubectl get workflow -n usecase3-persistence
+```
+
+```
+NAME PROFILE VERSION URL READY REASON
+callbackstatetimeouts 0.0.1 True
+```
+
+4. Expose the workflow and get the url:
+
+```shell
+kubectl patch svc callbackstatetimeouts -p '{"spec": {"type": "NodePort"}}' -n usecase3-persistence
+```
+
+```shell
+ minikube service callbackstatetimeouts --url -n usecase3-persistence
+ ```
+
+5. Create a workflow instance:
+
+You must use the URL calculated in step 4.
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{}' http://192.168.49.2:30707/callbackstatetimeouts
+```
+
+**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index)
+
+6. Clean the use case:
+
+```shell
+kubectl delete namespace usecase3
+```
-To feed Data Index with workflow execution data, you must deploy a SonataFlow instance and configure it to send events to Data Index.
+## Use case 4
-### Prereqs
+This use case is intended to represent installation with:
-1. Install Data Index (see above)
-2. Install the SonataFlow Operator on Minikube; see the instructions in the [operator installation guide](https://sonataflow.org/serverlessworkflow/latest/cloud/operator/install-serverless-operator.html).
+* A singleton Data Index Service with PostgreSQL persistence
+* A singleton Jobs Service with PostgreSQL persistence configured to send job status events to the Data Index Service.
+* The `greeting` workflow (no persistence)
+* The `callbackstateworkflow` workflow (no persistence)
+* The `workflowtimeouts` workflow (no persistence)
+* The workflows are configured to register the process events on the Data Index Service.
+* The workflows are configured to create timers on the Jobs Service.
### Procedure
-Open a new terminal and run:
+Open a terminal and run the following commands:
+
+1. Create the namespace:
```shell
-kubectl apply -f sonataflow-greeting/
+kubectl create namespace usecase4
```
-It should build and deploy a new instance of the Greetings workflow in the same namespace where Data Index is deployed.
+2. Install the Data Index Service and the Jobs Service:
-To access the application, run:
+```shell
+kubectl kustomize infra/dataindex_and_jobservice | kubectl apply -f - -n usecase4
+```
+
+```
+configmap/dataindex-properties-hg9ff8bff5 created
+configmap/jobs-service-properties-9bf9cg9b9f created
+secret/postgres-secrets-22tkgc2dt7 created
+service/data-index-service-postgresql created
+service/jobs-service-postgresql created
+service/postgres created
+persistentvolumeclaim/postgres-pvc created
+deployment.apps/data-index-service-postgresql created
+deployment.apps/jobs-service-postgresql created
+deployment.apps/postgres created
+```
+
+Give some time for the data index and the job service to start, you can check that it's running by executing.
```shell
-kubectl patch svc greeting -p '{"spec": {"type": "NodePort"}}'
-minikube service greeting --url
+kubectl get pod -n usecase4
```
-This should expose the workflow and return the public endpoint.
+```
+NAME READY STATUS RESTARTS AGE
+data-index-service-postgresql-69f684d458-scxbr 1/1 Running 0 65s
+jobs-service-postgresql-5c9b74cfc5-qnvkh 1/1 Running 0 65s
+postgres-7f78499688-2dnj5 1/1 Running 0 65s
+```
-You can then use it to `curl` the REST endpoint and start a new workflow instance which will return immediately:
+3. Install the workflows:
```shell
-curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' http://${ENDPOINT}/greeting
+ kubectl kustomize usecases/usecase4 | kubectl apply -f - -n usecase4
+ ```
+
```
+configmap/callbackstatetimeouts-props created
+configmap/greeting-props created
+configmap/workflowtimeouts-props created
+sonataflow.sonataflow.org/callbackstatetimeouts created
+sonataflow.sonataflow.org/greeting created
+sonataflow.sonataflow.org/workflowtimeouts created
+sonataflowplatform.sonataflow.org/sonataflow-platform created
+```
+
+Give some time for the sonataflow operator to build and deploy the workflow.
+To check that the workflows are ready you can use this command.
-Replace `${ENDPOINT}` with the output from the previous command.
+```shell
+kubectl get workflow -n usecase4
+```
+
+```
+NAME PROFILE VERSION URL READY REASON
+callbackstatetimeouts 0.0.1 True
+greeting 0.0.1 True
+workflowtimeouts 0.0.1 True
+```
+
+4. Expose the workflows and get the urls:
+
+```shell
+kubectl patch svc greeting callbackstatetimeouts workflowtimeouts -p '{"spec": {"type": "NodePort"}}' -n usecase4
+```
+
+```shell
+minikube service greeting --url -n usecase4
+ ```
+
+```shell
+minikube service callbackstatetimeouts --url -n usecase4
+ ```
+
+```shell
+minikube service workflowtimeouts --url -n usecase4
+```
+
+5. Create a workflow instances:
+
+You must use the URLs calculated in step 4.
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name": "John", "language": "English"}' http://192.168.49.2:32407/greeting
+```
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{}' http://192.168.49.2:30707/callbackstatetimeouts
+```
+
+```shell
+curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{}' http://192.168.49.2:30083/workflowtimeouts
+```
+
+**To execute queries and see the workflows information see:** [Querying Index Queries](#querying-data-index)
+
+
+6. Clean the use case:
+
+```shell
+kubectl delete namespace usecase4
+```
## Querying Data Index
-You can use the public Data Index endpoint to play around with the GraphiQL interface. Try submiting:
+You can use the public Data Index endpoint to play around with the GraphiQL interface.
+
+### Procedure
+
+This procedure apply to all use cases with that deploys the Data Index Service.
+
+1. Get the Data Index Url:
+
+```shell
+minikube service data-index-service-postgresql --url -n my_usecase
+```
+
+2. Open the GrahiqlUI
+
+Using the url returned in 1, open a browser window in the following url http://192.168.49.2:32409/graphiql/, note that IP and port will be different in your installation, and don't forget to add the last slash "/" to the url, otherwise the GraphiqlUI won't be opened.
+
+
+To see the process instances information you can execute this query:
```graphql
{
- ProcessInstances {
- id
- processName
- endpoint
- variables
- serviceUrl
- }
+ ProcessInstances {
+ id,
+ processId,
+ processName,
+ variables,
+ state,
+ endpoint,
+ serviceUrl,
+ start,
+ end
+ }
+}
+```
+
+The results should be something like:
+
+
+```json
+{
+ "data": {
+ "ProcessInstances": [
+ {
+ "id": "3ed8bf63-85c9-425d-9099-49bfb63608cb",
+ "processId": "greeting",
+ "processName": "workflow",
+ "variables": "{\"workflowdata\":{\"name\":\"John\",\"greeting\":\"Hello from JSON Workflow, \",\"language\":\"English\"}}",
+ "state": "COMPLETED",
+ "endpoint": "/greeting",
+ "serviceUrl": "http://greeting",
+ "start": "2023-09-13T06:59:24.319Z",
+ "end": "2023-09-13T06:59:24.400Z"
+ }
+ ]
+ }
+}
+```
+
+To see the jobs instances information, if any, you can execute this query:
+
+```graphql
+{
+ Jobs {
+ id,
+ processId,
+ processInstanceId,
+ status,
+ expirationTime,
+ retries,
+ endpoint,
+ callbackEndpoint
+ }
}
```
@@ -96,16 +733,19 @@ The results should be something like:
```json
{
- "data":{
- "ProcessInstances":[
- {
- "id":"3ed8bf63-85c9-425d-9099-49bfb63608cb",
- "processName":"workflow",
- "endpoint":"/greeting",
- "variables":"{\"workflowdata\":{\"name\":\"John\",\"greeting\":\"Hello from JSON Workflow, \",\"language\":\"English\"}}",
- "serviceUrl":null
- }
- ]
+ "data": {
+ "Jobs": [
+ {
+ "id": "55c7aadb-3dff-4b97-af8e-cc45014b1c0d",
+ "processId": "callbackstatetimeouts",
+ "processInstanceId": "299886b7-2b78-4965-a701-16783c4162d8",
+ "status": "EXECUTED",
+ "expirationTime": null,
+ "retries": 0,
+ "endpoint": "http://jobs-service-postgresql/jobs",
+ "callbackEndpoint": "http://callbackstatetimeouts:80/management/jobs/callbackstatetimeouts/instances/299886b7-2b78-4965-a701-16783c4162d8/timers/-1"
+ }
+ ]
}
}
```
diff --git a/dataindex/kustomization.yaml b/dataindex/kustomization.yaml
deleted file mode 100644
index 5d9ddf9..0000000
--- a/dataindex/kustomization.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-resources:
-- 01-postgres.yaml
-- 02-dataindex.yaml
-
-secretGenerator:
-- name: postgres-secrets
- literals:
- - POSTGRES_USER=sonataflow
- - POSTGRES_PASSWORD=sonataflow
- - POSTGRES_DB=sonataflow
- - PGDATA=/var/lib/postgresql/data/mydata
-
-configMapGenerator:
- - name: dataindex-properties
- literals:
- - QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=data-index-service
- - QUARKUS_DATASOURCE_DB_KIND=postgres
- - QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=update
- - QUARKUS_KAFKA_HEALTH_ENABLE=false
- - QUARKUS_HTTP_CORS=true
- - QUARKUS_HTTP_CORS_ORIGINS=/.*/
- - QUARKUS_FLYWAY_MIGRATE_AT_START=true
- - KOGITO_DATA_INDEX_QUARKUS_PROFILE=http-events-support
- - QUARKUS_HTTP_PORT=8080
diff --git a/dataindex/01-postgres.yaml b/infra/dataindex/01-postgres.yaml
similarity index 100%
rename from dataindex/01-postgres.yaml
rename to infra/dataindex/01-postgres.yaml
diff --git a/dataindex/02-dataindex.yaml b/infra/dataindex/02-dataindex.yaml
similarity index 54%
rename from dataindex/02-dataindex.yaml
rename to infra/dataindex/02-dataindex.yaml
index a15dedf..f15cd0c 100644
--- a/dataindex/02-dataindex.yaml
+++ b/infra/dataindex/02-dataindex.yaml
@@ -27,11 +27,13 @@ spec:
name: http
protocol: TCP
env:
+ - name: KOGITO_DATA_INDEX_QUARKUS_PROFILE
+ value: http-events-support
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- - name: QUARKUS_DATASOURCE_USERNAME
+ - name: QUARKUS_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
key: POSTGRES_USER
@@ -41,9 +43,38 @@ spec:
secretKeyRef:
key: POSTGRES_PASSWORD
name: postgres-secrets
- envFrom:
- - configMapRef:
- name: dataindex-properties
+ volumeMounts:
+ - name: application-config
+ mountPath: "/home/kogito/config"
+ livenessProbe:
+ failureThreshold: 3
+ httpGet:
+ path: /q/health/live
+ port: 8080
+ scheme: HTTP
+ initialDelaySeconds: 0
+ periodSeconds: 30
+ successThreshold: 1
+ timeoutSeconds: 10
+ readinessProbe:
+ failureThreshold: 3
+ httpGet:
+ path: /q/health/ready
+ port: 8080
+ scheme: HTTP
+ initialDelaySeconds: 0
+ periodSeconds: 30
+ successThreshold: 1
+ timeoutSeconds: 10
+ volumes:
+ - name: application-config
+ configMap:
+ name: dataindex-properties
+ initContainers:
+ - name: init-postgres
+ image: busybox:1.36
+ imagePullPolicy: IfNotPresent
+ command: ['sh', '-c', 'until nc -vz postgres.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local 5432; do echo "Waiting for postgres server"; sleep 3; done;']
---
apiVersion: v1
kind: Service
diff --git a/infra/dataindex/application.properties b/infra/dataindex/application.properties
new file mode 100644
index 0000000..ac88f78
--- /dev/null
+++ b/infra/dataindex/application.properties
@@ -0,0 +1,10 @@
+quarkus.http.port=8080
+quarkus.http.cors=true
+quarkus.http.cors.origins=/.*/
+
+quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=data-index-service
+quarkus.hibernate-orm.database.generation=update
+quarkus.flyway.migrate-at-start=true
+
+# Disable kafka client health check since the quarkus-http connector is being used instead.
+quarkus.smallrye-health.check."io.quarkus.kafka.client.health.KafkaHealthCheck".enabled=false
\ No newline at end of file
diff --git a/infra/dataindex/kustomization.yaml b/infra/dataindex/kustomization.yaml
new file mode 100644
index 0000000..d475d83
--- /dev/null
+++ b/infra/dataindex/kustomization.yaml
@@ -0,0 +1,17 @@
+resources:
+- 01-postgres.yaml
+- 02-dataindex.yaml
+
+secretGenerator:
+ - name: postgres-secrets
+ literals:
+ - POSTGRES_USER=sonataflow
+ - POSTGRES_PASSWORD=sonataflow
+ - POSTGRES_DB=sonataflow
+ - PGDATA=/var/lib/postgresql/data/mydata
+
+configMapGenerator:
+ - name: dataindex-properties
+ files:
+ - application.properties
+
diff --git a/infra/dataindex_and_jobservice/03-jobservice.yml b/infra/dataindex_and_jobservice/03-jobservice.yml
new file mode 100644
index 0000000..a177ed1
--- /dev/null
+++ b/infra/dataindex_and_jobservice/03-jobservice.yml
@@ -0,0 +1,91 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app.kubernetes.io/name: jobs-service-postgresql
+ name: jobs-service-postgresql
+spec:
+ replicas: 1
+ # remove after https://issues.redhat.com/browse/KOGITO-8311 is done
+ strategy:
+ type: Recreate
+ selector:
+ matchLabels:
+ app.kubernetes.io/name: jobs-service-postgresql
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/name: jobs-service-postgresql
+ spec:
+ containers:
+ - name: jobs-service-postgresql
+ image: quay.io/kiegroup/kogito-jobs-service-allinone:latest
+ imagePullPolicy: Always
+ ports:
+ - containerPort: 8080
+ name: http
+ protocol: TCP
+ env:
+ - name: JOBS_SERVICE_PERSISTENCE
+ value: postgresql
+ - name: KUBERNETES_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: QUARKUS_DATASOURCE_USERNAME
+ valueFrom:
+ secretKeyRef:
+ key: POSTGRES_USER
+ name: postgres-secrets
+ - name: QUARKUS_DATASOURCE_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ key: POSTGRES_PASSWORD
+ name: postgres-secrets
+ volumeMounts:
+ - name: application-config
+ mountPath: "/home/kogito/config"
+ livenessProbe:
+ failureThreshold: 3
+ httpGet:
+ path: /q/health/live
+ port: 8080
+ scheme: HTTP
+ initialDelaySeconds: 0
+ periodSeconds: 30
+ successThreshold: 1
+ timeoutSeconds: 10
+ readinessProbe:
+ failureThreshold: 3
+ httpGet:
+ path: /q/health/ready
+ port: 8080
+ scheme: HTTP
+ initialDelaySeconds: 0
+ periodSeconds: 30
+ successThreshold: 1
+ timeoutSeconds: 10
+ volumes:
+ - name: application-config
+ configMap:
+ name: jobs-service-properties
+ initContainers:
+ - name: init-postgres
+ image: busybox:1.36
+ imagePullPolicy: IfNotPresent
+ command: ['sh', '-c', 'until nc -vz postgres.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local 5432; do echo "Waiting for postgres server"; sleep 3; done;']
+---
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app.kubernetes.io/name: jobs-service-postgresql
+ name: jobs-service-postgresql
+spec:
+ ports:
+ - name: http
+ port: 80
+ targetPort: 8080
+ selector:
+ app.kubernetes.io/name: jobs-service-postgresql
+ type: NodePort
diff --git a/infra/dataindex_and_jobservice/application.properties b/infra/dataindex_and_jobservice/application.properties
new file mode 100644
index 0000000..d54cae8
--- /dev/null
+++ b/infra/dataindex_and_jobservice/application.properties
@@ -0,0 +1,13 @@
+kogito.service.url=http://jobs-service-postgresql
+
+quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=jobs-service
+quarkus.datasource.reactive.url=postgresql://postgres:5432/sonataflow?search_path=jobs-service
+
+# Enable the job status change events notification.
+kogito.jobs-service.http.job-status-change-events=true
+# Deliver the job status change events directly to the data-index-service-postgresql.
+mp.messaging.outgoing.kogito-job-service-job-status-events-http.url=http://data-index-service-postgresql/jobs
+# Disable the K_SINK injection health check since we knative eventing is not being used.
+quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled=false
+# if you use env variables you must use this env var instead.
+#QUARKUS_SMALLRYE_HEALTH_CHECK__ORG_KIE_KOGITO_JOBS_SERVICE_MESSAGING_HTTP_HEALTH_KNATIVE_KSINKINJECTIONHEALTHCHECK__ENABLED=false
diff --git a/infra/dataindex_and_jobservice/kustomization.yaml b/infra/dataindex_and_jobservice/kustomization.yaml
new file mode 100644
index 0000000..139ffe5
--- /dev/null
+++ b/infra/dataindex_and_jobservice/kustomization.yaml
@@ -0,0 +1,8 @@
+resources:
+- ../dataindex
+- 03-jobservice.yml
+
+configMapGenerator:
+ - name: jobs-service-properties
+ files:
+ - application.properties
\ No newline at end of file
diff --git a/infra/service_discovery/01-service-discovery-role.yaml b/infra/service_discovery/01-service-discovery-role.yaml
new file mode 100644
index 0000000..d337d25
--- /dev/null
+++ b/infra/service_discovery/01-service-discovery-role.yaml
@@ -0,0 +1,36 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ name: service-discovery-role
+rules:
+ - apiGroups:
+ - ""
+ resources:
+ - pods
+ - services
+ verbs:
+ - get
+ - list
+ - apiGroups:
+ - apps
+ resources:
+ - deployments
+ - statefulsets
+ verbs:
+ - get
+ - list
+ - apiGroups:
+ - networking.k8s.io
+ resources:
+ - ingresses
+ verbs:
+ - get
+ - list
+ # Knative
+ - apiGroups:
+ - serving.knative.dev
+ resources:
+ - services
+ verbs:
+ - get
+ - list
diff --git a/infra/service_discovery/02-service-discovery-rolebinding.yaml b/infra/service_discovery/02-service-discovery-rolebinding.yaml
new file mode 100644
index 0000000..f96435a
--- /dev/null
+++ b/infra/service_discovery/02-service-discovery-rolebinding.yaml
@@ -0,0 +1,11 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ name: service-discovery-rolebinding
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: service-discovery-role
+subjects:
+ - kind: ServiceAccount
+ name: default
\ No newline at end of file
diff --git a/infra/service_discovery/kustomization.yaml b/infra/service_discovery/kustomization.yaml
new file mode 100644
index 0000000..13ad16a
--- /dev/null
+++ b/infra/service_discovery/kustomization.yaml
@@ -0,0 +1,3 @@
+resources:
+- 01-service-discovery-role.yaml
+- 02-service-discovery-rolebinding.yaml
diff --git a/platforms/dataindex_and_jobservice_platform/01-sonataflow_platform.yaml b/platforms/dataindex_and_jobservice_platform/01-sonataflow_platform.yaml
new file mode 100644
index 0000000..8f6ade7
--- /dev/null
+++ b/platforms/dataindex_and_jobservice_platform/01-sonataflow_platform.yaml
@@ -0,0 +1,13 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowPlatform
+metadata:
+ name: sonataflow-platform
+spec:
+ build:
+ template:
+ buildArgs:
+ - name: QUARKUS_EXTENSIONS
+ value: org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:2.0.0-SNAPSHOT
+ config:
+ strategyOptions:
+ KanikoBuildCacheEnabled: "true"
diff --git a/platforms/dataindex_and_jobservice_platform/kustomization.yaml b/platforms/dataindex_and_jobservice_platform/kustomization.yaml
new file mode 100644
index 0000000..56c8eb9
--- /dev/null
+++ b/platforms/dataindex_and_jobservice_platform/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+- 01-sonataflow_platform.yaml
diff --git a/platforms/dataindex_and_jobservice_platform_persistence/01-sonataflow_platform.yaml b/platforms/dataindex_and_jobservice_platform_persistence/01-sonataflow_platform.yaml
new file mode 100644
index 0000000..7a4e8f4
--- /dev/null
+++ b/platforms/dataindex_and_jobservice_platform_persistence/01-sonataflow_platform.yaml
@@ -0,0 +1,13 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowPlatform
+metadata:
+ name: sonataflow-platform
+spec:
+ build:
+ template:
+ buildArgs:
+ - name: QUARKUS_EXTENSIONS
+ value: org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:2.0.0-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:2.16.10.Final,io.quarkus:quarkus-agroal:2.16.10.Final
+ config:
+ strategyOptions:
+ KanikoBuildCacheEnabled: "true"
diff --git a/platforms/dataindex_and_jobservice_platform_persistence/kustomization.yaml b/platforms/dataindex_and_jobservice_platform_persistence/kustomization.yaml
new file mode 100644
index 0000000..56c8eb9
--- /dev/null
+++ b/platforms/dataindex_and_jobservice_platform_persistence/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+- 01-sonataflow_platform.yaml
diff --git a/platforms/dataindex_platform/01-sonataflow_platform.yaml b/platforms/dataindex_platform/01-sonataflow_platform.yaml
new file mode 100644
index 0000000..11b3b3a
--- /dev/null
+++ b/platforms/dataindex_platform/01-sonataflow_platform.yaml
@@ -0,0 +1,16 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowPlatform
+metadata:
+ name: sonataflow-platform
+spec:
+ build:
+# kogito-swf-builder and kogito-swf-builder-nightly images already adds:
+# kogito-addons-quarkus-events-process and kogito-addons-quarkus-process-management
+# we shouldn't need to add them again, unless we want to protect from future changes on these images.
+# template:
+# buildArgs:
+# - name: QUARKUS_EXTENSIONS
+# value: org.kie.kogito:kogito-addons-quarkus-events-process:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-process-management:2.0.0-SNAPSHOT
+ config:
+ strategyOptions:
+ KanikoBuildCacheEnabled: "true"
diff --git a/platforms/dataindex_platform/kustomization.yaml b/platforms/dataindex_platform/kustomization.yaml
new file mode 100644
index 0000000..56c8eb9
--- /dev/null
+++ b/platforms/dataindex_platform/kustomization.yaml
@@ -0,0 +1,2 @@
+resources:
+- 01-sonataflow_platform.yaml
diff --git a/usecases/usecase1/kustomization.yaml b/usecases/usecase1/kustomization.yaml
new file mode 100644
index 0000000..6005850
--- /dev/null
+++ b/usecases/usecase1/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+- ../../platforms/dataindex_platform
+- ../../infra/service_discovery
+- ../../workflows/sonataflow-greeting
\ No newline at end of file
diff --git a/usecases/usecase2/kustomization.yaml b/usecases/usecase2/kustomization.yaml
new file mode 100644
index 0000000..cfa1a86
--- /dev/null
+++ b/usecases/usecase2/kustomization.yaml
@@ -0,0 +1,5 @@
+resources:
+- ../../platforms/dataindex_platform
+- ../../infra/service_discovery
+- ../../workflows/sonataflow-greeting
+- ../../workflows/sonataflow-helloworld
diff --git a/usecases/usecase3-persistence/kustomization.yaml b/usecases/usecase3-persistence/kustomization.yaml
new file mode 100644
index 0000000..4950db9
--- /dev/null
+++ b/usecases/usecase3-persistence/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+- ../../platforms/dataindex_and_jobservice_platform_persistence
+- ../../infra/service_discovery
+- ../../workflows/sonataflow-callbackstatetimeouts-persistence
diff --git a/usecases/usecase3/kustomization.yaml b/usecases/usecase3/kustomization.yaml
new file mode 100644
index 0000000..080df19
--- /dev/null
+++ b/usecases/usecase3/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+- ../../platforms/dataindex_and_jobservice_platform
+- ../../infra/service_discovery
+- ../../workflows/sonataflow-callbackstatetimeouts
diff --git a/usecases/usecase4/kustomization.yaml b/usecases/usecase4/kustomization.yaml
new file mode 100644
index 0000000..2d29f7f
--- /dev/null
+++ b/usecases/usecase4/kustomization.yaml
@@ -0,0 +1,6 @@
+resources:
+- ../../platforms/dataindex_and_jobservice_platform
+- ../../infra/service_discovery
+- ../../workflows/sonataflow-greeting
+- ../../workflows/sonataflow-callbackstatetimeouts
+- ../../workflows/sonataflow-workflowtimeouts
diff --git a/workflows/sonataflow-callbackstatetimeouts-persistence/02-configmap_callbackstatetimeouts-props.yaml b/workflows/sonataflow-callbackstatetimeouts-persistence/02-configmap_callbackstatetimeouts-props.yaml
new file mode 100644
index 0000000..8a66733
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts-persistence/02-configmap_callbackstatetimeouts-props.yaml
@@ -0,0 +1,42 @@
+apiVersion: v1
+data:
+ application.properties: |
+ kogito.service.url=${kubernetes:services.v1/callbackstatetimeouts}
+
+ # Job Service kogito-addons-quarkus-jobs-knative-eventing configuration
+ mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http
+ mp.messaging.outgoing.kogito-job-service-job-request-events.url=http://jobs-service-postgresql/v2/jobs/events
+
+ # Data Index configuration
+ mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
+
+ mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
+
+ mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
+
+ # Kogito runtime persistence configurations
+ kogito.persistence.type=jdbc
+ kogito.persistence.proto.marshaller=false
+ kogito.persistence.query.timeout.millis=10000
+ quarkus.datasource.db-kind=postgresql
+ quarkus.flyway.migrate-at-start=true
+ # TODO review why need to set this property if the kogito-addons-persistence-jdbc is already setting it
+ quarkus.flyway.locations=classpath:/db/postgresql
+
+ quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=sonataflow-runtime
+ quarkus.datasource.username=sonataflow
+ quarkus.datasource.password=sonataflow
+
+ quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
+ quarkus.log.category."org.kie".level = DEBUG
+ quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
+ quarkus.log.category."io.vertx".level = DEBUG
+kind: ConfigMap
+metadata:
+ labels:
+ app: callbackstatetimeouts
+ name: callbackstatetimeouts-props
diff --git a/workflows/sonataflow-callbackstatetimeouts-persistence/03-sonataflow_callbackstatetimeouts.sw.yaml b/workflows/sonataflow-callbackstatetimeouts-persistence/03-sonataflow_callbackstatetimeouts.sw.yaml
new file mode 100644
index 0000000..2a28a62
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts-persistence/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -0,0 +1,66 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: callbackstatetimeouts
+ annotations:
+ sonataflow.org/description: Callback State Timeouts Example k8s
+ sonataflow.org/version: 0.0.1
+spec:
+ flow:
+ start: PrintStartMessage
+ events:
+ - name: callbackEvent
+ source: ''
+ type: callback_event_type
+ functions:
+ - name: systemOut
+ type: custom
+ operation: sysout
+ states:
+ - name: PrintStartMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
+ transition: CallbackState
+ - name: CallbackState
+ type: callback
+ action:
+ name: callbackAction
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has executed the callbackFunction.\"}"
+ eventRef: callbackEvent
+ transition: CheckEventArrival
+ timeouts:
+ eventTimeout: PT30S
+ - name: CheckEventArrival
+ type: switch
+ dataConditions:
+ - condition: "${ .eventData != null }"
+ transition: EventArrived
+ defaultCondition:
+ transition: EventNotArrived
+ - name: EventArrived
+ type: inject
+ data:
+ exitMessage: "The callback event has arrived."
+ transition: PrintExitMessage
+ - name: EventNotArrived
+ type: inject
+ data:
+ exitMessage: "The callback event has not arrived, and the timeout has overdue."
+ transition: PrintExitMessage
+ - name: PrintExitMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has finalized. \" + .exitMessage + \" eventData: \" + .eventData}"
+ end: true
diff --git a/workflows/sonataflow-callbackstatetimeouts-persistence/kustomization.yaml b/workflows/sonataflow-callbackstatetimeouts-persistence/kustomization.yaml
new file mode 100644
index 0000000..3f72efb
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts-persistence/kustomization.yaml
@@ -0,0 +1,3 @@
+resources:
+- 02-configmap_callbackstatetimeouts-props.yaml
+- 03-sonataflow_callbackstatetimeouts.sw.yaml
diff --git a/workflows/sonataflow-callbackstatetimeouts/02-configmap_callbackstatetimeouts-props.yaml b/workflows/sonataflow-callbackstatetimeouts/02-configmap_callbackstatetimeouts-props.yaml
new file mode 100644
index 0000000..0f12cf3
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts/02-configmap_callbackstatetimeouts-props.yaml
@@ -0,0 +1,29 @@
+apiVersion: v1
+data:
+ application.properties: |
+ kogito.service.url=${kubernetes:services.v1/callbackstatetimeouts}
+
+ # Job Service kogito-addons-quarkus-jobs-knative-eventing configuration
+ mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http
+ mp.messaging.outgoing.kogito-job-service-job-request-events.url=http://jobs-service-postgresql/v2/jobs/events
+
+ # Data Index configuration
+ mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
+
+ mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
+
+ mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
+
+ quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
+ quarkus.log.category."org.kie".level = DEBUG
+ quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
+ quarkus.log.category."io.vertx".level = DEBUG
+kind: ConfigMap
+metadata:
+ labels:
+ app: callbackstatetimeouts
+ name: callbackstatetimeouts-props
diff --git a/workflows/sonataflow-callbackstatetimeouts/03-sonataflow_callbackstatetimeouts.sw.yaml b/workflows/sonataflow-callbackstatetimeouts/03-sonataflow_callbackstatetimeouts.sw.yaml
new file mode 100644
index 0000000..2a28a62
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts/03-sonataflow_callbackstatetimeouts.sw.yaml
@@ -0,0 +1,66 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: callbackstatetimeouts
+ annotations:
+ sonataflow.org/description: Callback State Timeouts Example k8s
+ sonataflow.org/version: 0.0.1
+spec:
+ flow:
+ start: PrintStartMessage
+ events:
+ - name: callbackEvent
+ source: ''
+ type: callback_event_type
+ functions:
+ - name: systemOut
+ type: custom
+ operation: sysout
+ states:
+ - name: PrintStartMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
+ transition: CallbackState
+ - name: CallbackState
+ type: callback
+ action:
+ name: callbackAction
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has executed the callbackFunction.\"}"
+ eventRef: callbackEvent
+ transition: CheckEventArrival
+ timeouts:
+ eventTimeout: PT30S
+ - name: CheckEventArrival
+ type: switch
+ dataConditions:
+ - condition: "${ .eventData != null }"
+ transition: EventArrived
+ defaultCondition:
+ transition: EventNotArrived
+ - name: EventArrived
+ type: inject
+ data:
+ exitMessage: "The callback event has arrived."
+ transition: PrintExitMessage
+ - name: EventNotArrived
+ type: inject
+ data:
+ exitMessage: "The callback event has not arrived, and the timeout has overdue."
+ transition: PrintExitMessage
+ - name: PrintExitMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"callback-state-timeouts: \" + $WORKFLOW.instanceId + \" has finalized. \" + .exitMessage + \" eventData: \" + .eventData}"
+ end: true
diff --git a/workflows/sonataflow-callbackstatetimeouts/kustomization.yaml b/workflows/sonataflow-callbackstatetimeouts/kustomization.yaml
new file mode 100644
index 0000000..3f72efb
--- /dev/null
+++ b/workflows/sonataflow-callbackstatetimeouts/kustomization.yaml
@@ -0,0 +1,3 @@
+resources:
+- 02-configmap_callbackstatetimeouts-props.yaml
+- 03-sonataflow_callbackstatetimeouts.sw.yaml
diff --git a/workflows/sonataflow-greeting/02-configmap_greeting-props.yaml b/workflows/sonataflow-greeting/02-configmap_greeting-props.yaml
new file mode 100644
index 0000000..e1ba2be
--- /dev/null
+++ b/workflows/sonataflow-greeting/02-configmap_greeting-props.yaml
@@ -0,0 +1,25 @@
+apiVersion: v1
+data:
+ application.properties: |
+ kogito.service.url=${kubernetes:services.v1/greeting}
+
+ # Data Index configuration
+ mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
+
+ mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
+
+ mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
+
+ quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
+ quarkus.log.category."org.kie".level = DEBUG
+ quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
+ quarkus.log.category."io.vertx".level = DEBUG
+kind: ConfigMap
+metadata:
+ labels:
+ app: greeting
+ name: greeting-props
diff --git a/sonataflow-greeting/03-sonataflow_greeting.yaml b/workflows/sonataflow-greeting/03-sonataflow_greeting.yaml
similarity index 100%
rename from sonataflow-greeting/03-sonataflow_greeting.yaml
rename to workflows/sonataflow-greeting/03-sonataflow_greeting.yaml
diff --git a/workflows/sonataflow-greeting/kustomization.yaml b/workflows/sonataflow-greeting/kustomization.yaml
new file mode 100644
index 0000000..36b47a7
--- /dev/null
+++ b/workflows/sonataflow-greeting/kustomization.yaml
@@ -0,0 +1,3 @@
+resources:
+- 02-configmap_greeting-props.yaml
+- 03-sonataflow_greeting.yaml
diff --git a/workflows/sonataflow-helloworld/02-configmap_helloworld-props.yaml b/workflows/sonataflow-helloworld/02-configmap_helloworld-props.yaml
new file mode 100644
index 0000000..1abb2db
--- /dev/null
+++ b/workflows/sonataflow-helloworld/02-configmap_helloworld-props.yaml
@@ -0,0 +1,25 @@
+apiVersion: v1
+data:
+ application.properties: |
+ kogito.service.url=${kubernetes:services.v1/helloworld}
+
+ # Data Index configuration
+ mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
+
+ mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
+
+ mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
+
+ quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
+ quarkus.log.category."org.kie".level = DEBUG
+ quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
+ quarkus.log.category."io.vertx".level = DEBUG
+kind: ConfigMap
+metadata:
+ labels:
+ app: helloworld
+ name: helloworld-props
diff --git a/workflows/sonataflow-helloworld/03-sonataflow_helloworld.yaml b/workflows/sonataflow-helloworld/03-sonataflow_helloworld.yaml
new file mode 100644
index 0000000..ed8dd54
--- /dev/null
+++ b/workflows/sonataflow-helloworld/03-sonataflow_helloworld.yaml
@@ -0,0 +1,21 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: helloworld
+ annotations:
+ sonataflow.org/description: Hello World Workflow
+ sonataflow.org/version: 0.0.1
+spec:
+ flow:
+ start: Inject Hello World
+ states:
+ - name: Inject Hello World
+ type: inject
+ data:
+ greeting: Hello World
+ transition: Inject Mantra
+ - name: Inject Mantra
+ type: inject
+ data:
+ mantra: Serverless Workflow is awesome!
+ end: true
\ No newline at end of file
diff --git a/workflows/sonataflow-helloworld/kustomization.yaml b/workflows/sonataflow-helloworld/kustomization.yaml
new file mode 100644
index 0000000..20cb065
--- /dev/null
+++ b/workflows/sonataflow-helloworld/kustomization.yaml
@@ -0,0 +1,3 @@
+resources:
+- 02-configmap_helloworld-props.yaml
+- 03-sonataflow_helloworld.yaml
diff --git a/sonataflow-greeting/01-sonataflow_platform.yaml b/workflows/sonataflow-timeouts-showcase/01-sonataflow_platform.yaml
similarity index 79%
rename from sonataflow-greeting/01-sonataflow_platform.yaml
rename to workflows/sonataflow-timeouts-showcase/01-sonataflow_platform.yaml
index e394280..873e615 100644
--- a/sonataflow-greeting/01-sonataflow_platform.yaml
+++ b/workflows/sonataflow-timeouts-showcase/01-sonataflow_platform.yaml
@@ -7,7 +7,7 @@ spec:
template:
buildArgs:
- name: QUARKUS_EXTENSIONS
- value: org.kie.kogito:kogito-addons-quarkus-events-process:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-process-management:2.0.0-SNAPSHOT
+ value: org.kie.kogito:kogito-addons-quarkus-events-process:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-process-management:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:2.0.0-SNAPSHOT
config:
strategyOptions:
KanikoBuildCacheEnabled: "true"
diff --git a/sonataflow-greeting/02-configmap_order-props.yaml b/workflows/sonataflow-timeouts-showcase/02-configmap_workflowtimeouts-props.yaml
similarity index 63%
rename from sonataflow-greeting/02-configmap_order-props.yaml
rename to workflows/sonataflow-timeouts-showcase/02-configmap_workflowtimeouts-props.yaml
index 1f56a4d..557897d 100644
--- a/sonataflow-greeting/02-configmap_order-props.yaml
+++ b/workflows/sonataflow-timeouts-showcase/02-configmap_workflowtimeouts-props.yaml
@@ -1,20 +1,25 @@
apiVersion: v1
data:
application.properties: |
+ kogito.service.url=http://workflowtimeouts
+
+ # Job Service kogito-addons-quarkus-jobs-knative-eventing configuration
+ mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http
+ mp.messaging.outgoing.kogito-job-service-job-request-events.url=http://jobs-service-postgresql/v2/jobs/events
+
# Data Index configuration
mp.messaging.outgoing.kogito-processinstances-events.connector=quarkus-http
- mp.messaging.outgoing.kogito-processinstances-events.topic=kogito-processinstances-events
mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
mp.messaging.outgoing.kogito-usertaskinstances-events.connector=quarkus-http
- mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events
mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
- mp.messaging.outgoing.kogito-usertaskinstances-events.method=POST
mp.messaging.outgoing.kogito-variables-events.connector=quarkus-http
- mp.messaging.outgoing.kogito-variables-events.topic=kogito-variables-events
mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
- mp.messaging.outgoing.kogito-variables-events.method=POST
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
quarkus.log.category."org.kie".level = DEBUG
@@ -23,5 +28,5 @@ data:
kind: ConfigMap
metadata:
labels:
- app: greeting
- name: greeting-props
+ app: workflowtimeouts
+ name: workflowtimeouts-props
diff --git a/workflows/sonataflow-timeouts-showcase/03-sonataflow_workflowtimeouts.yaml b/workflows/sonataflow-timeouts-showcase/03-sonataflow_workflowtimeouts.yaml
new file mode 100644
index 0000000..6fd2bc9
--- /dev/null
+++ b/workflows/sonataflow-timeouts-showcase/03-sonataflow_workflowtimeouts.yaml
@@ -0,0 +1,42 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: workflowtimeouts
+ annotations:
+ sonataflow.org/description: Workflow Timeouts Example k8s
+ sonataflow.org/version: 0.0.1
+spec:
+ flow:
+ start: PrintStartMessage
+ timeouts:
+ workflowExecTimeout:
+ duration: 'PT30S'
+ events:
+ - name: wakeUpEvent
+ source: ''
+ type: wake_up_event_type
+ functions:
+ - name: systemOut
+ type: custom
+ operation: sysout
+ states:
+ - name: PrintStartMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"workflow-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
+ transition: WaitForEvent
+ - name: WaitForEvent
+ type: event
+ onEvents:
+ - eventRefs: [ wakeUpEvent ]
+ actions:
+ - name: printAfterWakeUpEvent
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"workflow-timeouts: \" + $WORKFLOW.instanceId + \" executing actions for wake_up_event.\"}"
+ end: true
\ No newline at end of file
diff --git a/workflows/sonataflow-timeouts-showcase/kustomization.yaml b/workflows/sonataflow-timeouts-showcase/kustomization.yaml
new file mode 100644
index 0000000..0a6dad5
--- /dev/null
+++ b/workflows/sonataflow-timeouts-showcase/kustomization.yaml
@@ -0,0 +1,6 @@
+resources:
+- ../sonataflow-callbackstatetimeouts
+- 02-configmap_workflowtimeouts-props.yaml
+- 03-sonataflow_workflowtimeouts.yaml
+- 04-configmap_callbackstatetimeouts-props.yaml
+- 05-sonataflow_callbackstatetimeouts.sw.yaml
diff --git a/workflows/sonataflow-workflowtimeouts/02-configmap_workflowtimeouts-props.yaml b/workflows/sonataflow-workflowtimeouts/02-configmap_workflowtimeouts-props.yaml
new file mode 100644
index 0000000..7a7faa1
--- /dev/null
+++ b/workflows/sonataflow-workflowtimeouts/02-configmap_workflowtimeouts-props.yaml
@@ -0,0 +1,29 @@
+apiVersion: v1
+data:
+ application.properties: |
+ kogito.service.url=${kubernetes:services.v1/workflowtimeouts}
+
+ # Job Service kogito-addons-quarkus-jobs-knative-eventing configuration
+ mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http
+ mp.messaging.outgoing.kogito-job-service-job-request-events.url=http://jobs-service-postgresql/v2/jobs/events
+
+ # Data Index configuration
+ mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
+
+ mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
+
+ mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
+
+ # Skip user tasks and variables events sending.
+ kogito.events.usertasks.enabled=false
+ kogito.events.variables.enabled=false
+
+ quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
+ quarkus.log.category."org.kie".level = DEBUG
+ quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
+ quarkus.log.category."io.vertx".level = DEBUG
+kind: ConfigMap
+metadata:
+ labels:
+ app: workflowtimeouts
+ name: workflowtimeouts-props
diff --git a/workflows/sonataflow-workflowtimeouts/03-sonataflow_workflowtimeouts.yaml b/workflows/sonataflow-workflowtimeouts/03-sonataflow_workflowtimeouts.yaml
new file mode 100644
index 0000000..6fd2bc9
--- /dev/null
+++ b/workflows/sonataflow-workflowtimeouts/03-sonataflow_workflowtimeouts.yaml
@@ -0,0 +1,42 @@
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: workflowtimeouts
+ annotations:
+ sonataflow.org/description: Workflow Timeouts Example k8s
+ sonataflow.org/version: 0.0.1
+spec:
+ flow:
+ start: PrintStartMessage
+ timeouts:
+ workflowExecTimeout:
+ duration: 'PT30S'
+ events:
+ - name: wakeUpEvent
+ source: ''
+ type: wake_up_event_type
+ functions:
+ - name: systemOut
+ type: custom
+ operation: sysout
+ states:
+ - name: PrintStartMessage
+ type: operation
+ actions:
+ - name: printSystemOut
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"workflow-timeouts: \" + $WORKFLOW.instanceId + \" has started.\"}"
+ transition: WaitForEvent
+ - name: WaitForEvent
+ type: event
+ onEvents:
+ - eventRefs: [ wakeUpEvent ]
+ actions:
+ - name: printAfterWakeUpEvent
+ functionRef:
+ refName: systemOut
+ arguments:
+ message: "${\"workflow-timeouts: \" + $WORKFLOW.instanceId + \" executing actions for wake_up_event.\"}"
+ end: true
\ No newline at end of file
diff --git a/workflows/sonataflow-workflowtimeouts/kustomization.yaml b/workflows/sonataflow-workflowtimeouts/kustomization.yaml
new file mode 100644
index 0000000..69e7b56
--- /dev/null
+++ b/workflows/sonataflow-workflowtimeouts/kustomization.yaml
@@ -0,0 +1,4 @@
+resources:
+- 02-configmap_workflowtimeouts-props.yaml
+- 03-sonataflow_workflowtimeouts.yaml
+