This example showcases the use of Serverless Workflow specification markup to create a job application decision workflow. It also showcases the power of Kogito to create a completely event-driven services example. The UI and workflow service communicate only over events (CloudEvents format) that are streamed to Kafka topics.
Here is the overall architecture of this example:
You will need:
- Java 17+ installed
- Environment variable JAVA_HOME set accordingly
- Maven 3.9.6+ installed
- Apache Kafka installed
When using native image compilation, you will also need:
- GraalVm 19.3.1+ installed
- Environment variable GRAALVM_HOME set accordingly
- Note that GraalVM native image compilation typically requires other packages (glibc-devel, zlib-devel and gcc) to be installed too. You also need 'native-image' installed in GraalVM (using 'gu install native-image'). Please refer to GraalVM installation documentation for more details.
This quickstart requires Apache Kafka to be available and by default expects it to be on default port and localhost.
- Install and Startup Kafka Server / Zookeeper
https://kafka.apache.org/quickstart
Optionally and for convenience, a docker-compose configuration file is provided in the path docker-compose/, where you can just run the command from there:
docker-compose up
In this way a container for Kafka will be started on port 9092.
mvn clean compile quarkus:dev
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/serverless-workflow-events-quarkus-runner
After starting the example application you can access the front-end page at:
http://localhost:8080/
You should see the following page:
Fill in the "Submit New Applicant" form and submit it. This will send a cloud event to Kafka which starts a new workflow instance. The workflow includes a rule function call which evaluates the salary entered. Before the workflow execution ends it sends a cloud event to Kafka. The UI subscribes to these events using SSE and updates the "Application Decision" table with the results, for example: