diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/data-index-services.yml b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/data-index-services.yml index f191c7ef7e..8f739b156b 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/data-index-services.yml +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/data-index-services.yml @@ -88,16 +88,98 @@ spec: value: "http-events-support" - name: QUARKUS_HTTP_PORT value: "8080" + - name: KOGITO_SERVICE_URL + value: http://data-index-service-postgresql --- apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: - name: data-index-service-postgresql-processes-trigger + name: data-index-service-postgresql-process-definition-trigger spec: broker: default filter: attributes: - type: ProcessInstanceEvent + type: ProcessDefinitionEvent + subscriber: + ref: + apiVersion: v1 + kind: Service + name: data-index-service-postgresql + uri: /definitions +--- +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: data-index-service-postgresql-process-error-trigger +spec: + broker: default + filter: + attributes: + type: ProcessInstanceErrorDataEvent + subscriber: + ref: + apiVersion: v1 + kind: Service + name: data-index-service-postgresql + uri: /processes +--- +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: data-index-service-postgresql-process-node-trigger +spec: + broker: default + filter: + attributes: + type: ProcessInstanceNodeDataEvent + subscriber: + ref: + apiVersion: v1 + kind: Service + name: data-index-service-postgresql + uri: /processes +--- +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: data-index-service-postgresql-process-sla-trigger +spec: + broker: default + filter: + attributes: + type: ProcessInstanceSLADataEvent + subscriber: + ref: + apiVersion: v1 + kind: Service + name: data-index-service-postgresql + uri: /processes +--- +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: data-index-service-postgresql-process-state-trigger +spec: + broker: default + filter: + attributes: + type: ProcessInstanceStateDataEvent + subscriber: + ref: + apiVersion: v1 + kind: Service + name: data-index-service-postgresql + uri: /processes +--- +apiVersion: eventing.knative.dev/v1 +kind: Trigger +metadata: + name: data-index-service-postgresql-process-variable-trigger +spec: + broker: default + filter: + attributes: + type: ProcessInstanceVariableDataEvent subscriber: ref: apiVersion: v1 diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/supporting-services.yml b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/supporting-services.yml index 64eab99807..f82d323c74 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/supporting-services.yml +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/kubernetes/supporting-services.yml @@ -173,6 +173,8 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: KOGITO_SERVICE_URL + value: http://jobs-service-postgresql - name: JOBS_SERVICE_PERSISTENCE value: "postgresql" - name: KOGITO_JOBS_SERVICE_HTTP_JOB_STATUS_CHANGE_EVENTS diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties index 008cfa2a48..8ce2a74312 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application-knative.properties @@ -37,37 +37,19 @@ quarkus.datasource.password=${POSTGRES_PASSWORD:pass} # Events produced by kogito-addons-quarkus-jobs-knative-eventing to program the timers on the jobs service. mp.messaging.outgoing.kogito-job-service-job-request-events.connector=quarkus-http -# The K_SINK variable is automatically injected by the Knative ecosystem. The default value http://localhost:8280 -# is used for local testing. mp.messaging.outgoing.kogito-job-service-job-request-events.url=${K_SINK:http://localhost:8280/v2/jobs/events} mp.messaging.outgoing.kogito-job-service-job-request-events.method=POST -# process, variables and user tasks events configuration. -mp.messaging.outgoing.kogito-processinstances-events.connector=quarkus-http -mp.messaging.outgoing.kogito-processinstances-events.url=${K_SINK:http://localhost:8180/processes} -mp.messaging.outgoing.kogito-processinstances-events.method=POST - kogito.events.usertasks.enabled=false -mp.messaging.outgoing.kogito-usertaskinstances-events.connector=quarkus-http -mp.messaging.outgoing.kogito-usertaskinstances-events.url=${K_SINK:http://localhost:8180/tasks} -mp.messaging.outgoing.kogito-usertaskinstances-events.method=POST - kogito.events.variables.enabled=false -mp.messaging.outgoing.kogito-variables-events.connector=quarkus-http -mp.messaging.outgoing.kogito-variables-events.url=${K_SINK:http://localhost:8180/variables} -mp.messaging.outgoing.kogito-variables-events.method=POST - -mp.messaging.outgoing.kogito-processdefinitions-events.connector=quarkus-http -mp.messaging.outgoing.kogito-processdefinitions-events.url={K_SINK:http://localhost:8180/definitions} -mp.messaging.outgoing.kogito-processdefinitions-events.method=POST +kogito.addon.messaging.outgoing.cloudEventMode=structured ## Knative integration: -# Use the Kogito service discovery mechanism to get the subscription-service url and set an env var with name SUBSCRIPTION_SERVICE_URL +# Use the Kogito service discovery mechanism to get the subscription-service url # For more information see: # https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/cloud/kubernetes-service-discovery.html -# https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs -quarkus.knative.env.vars.subscription_service_url=${knative:services.v1.serving.knative.dev/newsletter-showcase/subscription-service} +quarkus.rest-client.subscription_service_yaml.url=${knative:services.v1.serving.knative.dev/newsletter-showcase/subscription-service} # Configure current deployment to set an env var with name POSTGRES_HOST # For more information see: https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs @@ -84,7 +66,9 @@ quarkus.knative.env.vars.postgres_host=newsletter-postgres # you can change this property with -Pknative -Dquarkus.container-image.group from the command line. quarkus.container-image.group=dev.local quarkus.kubernetes.deployment-target=knative +# The name of the application. This value will be used for naming Kubernetes resources like: Deployment, Service, etc. quarkus.knative.name=subscription-flow +quarkus.container-image.name=${quarkus.knative.name} quarkus.knative.image-pull-policy=IfNotPresent # Kogito Knative integration diff --git a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application.properties index 51b8e8eeae..86b736b0b6 100644 --- a/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-newsletter-subscription/subscription-flow/src/main/resources/application.properties @@ -30,7 +30,7 @@ quarkus.log.category."org.kie.kogito.addon.quarkus.messaging".level=DEBUG # Internally, Kogito Serverless Workflow uses the Quarkus OpenAPI Generator extension. # The default value http://localhost:8282 is used for local testing. In kubernetes environments, the env var # SUBSCRIPTION_SERVICE_URL will be used instead. This env var is configured in the application-knative.properties file. -quarkus.rest-client.subscription_service_yaml.url=${SUBSCRIPTION_SERVICE_URL:http://localhost:8282} +quarkus.rest-client.subscription_service_yaml.url=http://localhost:8282 mp.messaging.incoming.kogito_incoming_stream.connector=quarkus-http mp.messaging.incoming.kogito_incoming_stream.path=/ @@ -48,22 +48,6 @@ mp.messaging.outgoing.kogito_outgoing_stream.url=${K_SINK:http://localhost:8181} %container.quarkus.container-image.registry=dev.local %container.quarkus.container-image.tag=1.0-SNAPSHOT -# process, variables and user tasks events configuration. -mp.messaging.outgoing.kogito-processinstances-events.connector=quarkus-http -mp.messaging.outgoing.kogito-processinstances-events.url=http://localhost:8180/processes -mp.messaging.outgoing.kogito-processinstances-events.method=POST - kogito.events.usertasks.enabled=false -mp.messaging.outgoing.kogito-usertaskinstances-events.connector=quarkus-http -mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://localhost:8180/tasks -mp.messaging.outgoing.kogito-usertaskinstances-events.method=POST - kogito.events.variables.enabled=false -mp.messaging.outgoing.kogito-variables-events.connector=quarkus-http -mp.messaging.outgoing.kogito-variables-events.url=http://localhost:8180/variables -mp.messaging.outgoing.kogito-variables-events.method=POST -# process definitions events configuration. -mp.messaging.outgoing.kogito-processdefinitions-events.connector=quarkus-http -mp.messaging.outgoing.kogito-processdefinitions-events.url=http://localhost:8180/definitions -mp.messaging.outgoing.kogito-processdefinitions-events.method=POST