A quickstart project that processes deals for travellers. It utilizes process composition to split the work of:
At the same time shows simplified version of an approval process that waits for a human actor to provide review.
This example shows
Note: The use of this example shows that the data sent to Kafka is saved, you can shut down the application and restart it and as long as Kafka is running after you restart you should still see the data
It utilizes a Kafka server as the backend store.
This quickstart requires an Apache Kafka to be available and by default expects it to be on default port and localhost.
https://kafka.apache.org/quickstart
Alternatively, you can use the provided Docker Compose file in src/main/docker. To get Kafka started in the localhost port 9092, simply run:
docker-compose up
You will need:
When using native image compilation, you will also need:
mvn clean compile quarkus:dev
NOTE: With dev mode of Quarkus you can take advantage of hot reload for business assets like processes, rules, decision tables and java code. No need to redeploy or restart your running application.
mvn clean package java -jar target/quarkus-app/quarkus-run.jar
or on windows
mvn clean package java -jar target\quarkus-app\quarkus-run.jar
Note that this requires GRAALVM_HOME to point to a valid GraalVM installation
mvn clean package -Pnative
To run the generated native executable, generated in target/
, execute
./target/process-kafka-persistence-quarkus-runner
You can take a look at the OpenAPI definition - automatically generated and included in this service - to determine all available operations exposed by this service. For easy readability you can visualize the OpenAPI definition file using a UI tool like for example available Swagger UI.
In addition, various clients to interact with this service can be easily generated using this OpenAPI definition.
When running in either Quarkus Development or Native mode, we also leverage the Quarkus OpenAPI extension that exposes Swagger UI that you can use to look at available REST endpoints and send test requests.
To make use of this application it is as simple as putting a sending request to http://localhost:8080/deals
with following content
{ "name" : "my fancy deal", "traveller" : { "firstName" : "John", "lastName" : "Doe", "email" : "jon.doe@example.com", "nationality" : "American", "address" : { "street" : "main street", "city" : "Boston", "zipCode" : "10005", "country" : "US" } } }
Complete curl command can be found below:
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name" : "my fancy deal", "traveller" : { "firstName" : "John", "lastName" : "Doe", "email" : "jon.doe@example.com", "nationality" : "American","address" : { "street" : "main street", "city" : "Boston", "zipCode" : "10005", "country" : "US" }}}' http://localhost:8080/deals
this will then trigger the review user task that you can work.
First you can display all active reviews of deals
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
based on the response you can select one of the reviews to see more details
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
where uuid is the id of the deal review you want to work with.
Next you can get the details assigned to review user task by
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
Last but not least you can complete review user task by
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
Review of the deal very good work for traveller Doe
In the operator
directory you'll find the custom resources needed to deploy this example on OpenShift with the Kogito Operator.