diff --git a/kogito-quarkus-examples/serverless-workflow-order-processing/README.md b/kogito-quarkus-examples/serverless-workflow-order-processing/README.md index 3756c3d2d8..6f5de905e9 100644 --- a/kogito-quarkus-examples/serverless-workflow-order-processing/README.md +++ b/kogito-quarkus-examples/serverless-workflow-order-processing/README.md @@ -239,13 +239,32 @@ to get started. Just make sure your cluster has [Knative Eventing available](https://knative.dev/docs/eventing/getting-started/): -1. [Install Knative](https://knative.dev/docs/getting-started/) -2. Install the `KogitoSource` [via command line](https://github.com/knative-sandbox/eventing-kogito#installation). -3. Run `eval $(minikube docker-env)` to build the image directly into the Minikube registry. -4. Run `mvn clean install -Pknative -Dnamespace=` to build the image and the Knative resources for your application to run. -5. Apply the objects created for you with `kubectl apply -f target/kubernetes/knative.yml,target/kubernetes/kogito.yml`. It will deploy the objects from `knative.yml` and `kogito.yml` generated files. -6. Run `curl` from the terminal like you did in the previously steps. - To see what's going on, just query for one of the Knative service sinks created on step #5. +1. Install [Minikube](https://minikube.sigs.k8s.io/docs/start/) +2. Enable Minikube internal image registry by running `minikube addons enable registry` +3. Install Knative using the [quickstart](https://knative.dev/docs/getting-started/) since a DNS will be configured for you. In case you need to restart Minikube, make sure you start it using the `knative` profile by running `minikube start -p knative`. +5. Run `eval $(minikube -p minikube docker-env --profile knative)` to configure your terminal to use the local Minikube instance. +6. Install the [Knative Kogito Source](https://github.com/knative-sandbox/eventing-kogito#installation). +7. Run `mvn clean install -Pknative -Dnamespace=knative` to build and push the image to Minikube registry and generate the Knative resources for your application to run. +8. Apply the objects created for you with `kubectl apply -f target/kubernetes/knative.yml,target/kubernetes/kogito.yml`. It will deploy the objects from `knative.yml` and `kogito.yml` generated files. +9. Run `curl` from the terminal like you did in the previously steps. + ```shell script + $ curl -X POST \ + -H "content-type: application/json" \ + -H "ce-specversion: 1.0" \ + -H "ce-source: /from/localhost" \ + -H "ce-type: orderEvent" \ + -H "ce-id: f0643c68-609c-48aa-a820-5df423fa4fe0" \ + -d ' {"id":"f0643c68-609c-48aa-a820-5df423fa4fe0","country":"Brazil","total":500,"description":"iPhone 7"}' \ + $(kn service describe serverless-workflow-order-processing -o url) + ``` +kubectl logs -l serving.knative.dev/service=event-display -c user-container +kubectl logs -l serving.knative.dev/service=shipping-domestic -c user-container +kubectl logs -l serving.knative.dev/service=shipping-international -c user-container + +kubectl logs -l app.kubernetes.io/name=serverless-workflow-order-processing +kubectl logs -l serving.knative.dev/service=serverless-workflow-order-processing -c user-container + + To see what's going on, just query for one of the Knative service sinks created on the previous step. You should see something like: ``` diff --git a/kogito-quarkus-examples/serverless-workflow-order-processing/pom.xml b/kogito-quarkus-examples/serverless-workflow-order-processing/pom.xml index befa78067b..3262200b01 100644 --- a/kogito-quarkus-examples/serverless-workflow-order-processing/pom.xml +++ b/kogito-quarkus-examples/serverless-workflow-order-processing/pom.xml @@ -113,6 +113,7 @@ ${deploy} true knative + true diff --git a/kogito-quarkus-examples/serverless-workflow-qas-service-showcase/README.md b/kogito-quarkus-examples/serverless-workflow-qas-service-showcase/README.md index 7648331edc..bd83f88381 100644 --- a/kogito-quarkus-examples/serverless-workflow-qas-service-showcase/README.md +++ b/kogito-quarkus-examples/serverless-workflow-qas-service-showcase/README.md @@ -66,11 +66,12 @@ In this example we use a regular, in-memory, broker. Feel free to adapt the exam ### Preparing your environment -1. Install [minikube](https://minikube.sigs.k8s.io/docs/start/) -2. Install Knative using the [quickstarts](https://knative.dev/docs/getting-started/) since a DNS will be configured for you. -3. Install the [Knative Kogito Source](https://github.com/knative-sandbox/eventing-kogito#installation). -4. Run `eval $(minikube -p minikube docker-env --profile knative)` to build the images in your internal Minikube registry. -5. Run `mvn clean install -Pknative`. All resources needed to run the example will be generated for you. +1. Install [Minikube](https://minikube.sigs.k8s.io/docs/start/) +2. Enable Minikube internal image registry by running `minikube addons enable registry` +3. Install Knative using the [quickstart](https://knative.dev/docs/getting-started/) since a DNS will be configured for you. In case you need to restart Minikube, make sure you start it using the `knative` profile by running `minikube start -p knative`. +4. Install the [Knative Kogito Source](https://github.com/knative-sandbox/eventing-kogito#installation). +5. Run `eval $(minikube -p minikube docker-env --profile knative)` to configure your terminal to use the local Minikube instance. +6. Run `mvn clean install -Pknative` to build and push the image to Minikube registry and generate the Knative resources for your application to run. Deploy the services with the following command: diff --git a/kogito-quarkus-examples/serverless-workflow-saga-quarkus/README.md b/kogito-quarkus-examples/serverless-workflow-saga-quarkus/README.md index 226547805c..7f2bbb1318 100644 --- a/kogito-quarkus-examples/serverless-workflow-saga-quarkus/README.md +++ b/kogito-quarkus-examples/serverless-workflow-saga-quarkus/README.md @@ -12,7 +12,7 @@ This is an example of how to implement the Saga pattern based on Serverless Work The compensations can be triggered by a transition setting the property `compensate` to `true`, this transition can be declared in a state that represents an error in the workflow. In the order workflow example, it is the `ServiceError` state. In general, the error in a state can be declared with the property `onErrors`, which may include a transition to a state that represents this error. -The functions to execute the steps and compensations in this example are implemented using Java classes under the project's `src`, for instance, [StockService](/src/main/java/org/kie/kogito/StockService.java). For this example, they are just mocking responses, but they could be executing calls to external services or any business logic in an actual use case. Other options can declare these operations, like OpenAPI, REST, or events. +The functions to execute the steps and compensations in this example are implemented using Java classes under the project's `src`, for instance, [StockService](./src/main/java/org/kie/kogito/StockService.java). For this example, they are just mocking responses, but they could be executing calls to external services or any business logic in an actual use case. Other options can declare these operations, like OpenAPI, REST, or events. The start point of the Saga workflow is to submit a request to create a new Order with a given `orderId`. This could be any other payload that represents an `Order`. For the sake of simplicity, in this example, it will be based on the `id` that could be used as a correlation key to the client starting the Saga workflow. @@ -31,6 +31,7 @@ This is the Serverless Workflow that represents the Order Saga. ### Prerequisites + You will need: - Java 11+ installed - Environment variable JAVA_HOME set accordingly @@ -196,8 +197,4 @@ In the console executing the application, you can check the log with the execute 2021-12-21 09:20:45,970 INFO [org.kie.kog.OrderService] (executor-thread-0) Order Failed 03e6cf79-3301-434b-b5e1-d6899b5639aa ``` -## Deploying with Kogito Operator - -In the [`operator`](operator) directory you'll find the custom resources needed to deploy this example on OpenShift with the [Kogito Operator](https://docs.jboss.org/kogito/release/latest/html_single/#chap_kogito-deploying-on-openshift). - See also: [SAGA PATTERN WITH PROCESSES AND KOGITO – PART 1](https://blog.kie.org/2021/11/saga-pattern-with-processes-and-kogito-part-1.html)