This example showcases the use of Serverless Workflow specification markup to create country information classification workflow. It also showcases how easy it is to create a simple AngularJS app/page which you can use to start workflow instances and show the country information classified by the example workflow.
The serverless workflow used in this example expects a name of a country. It then uses an Operation state to execute a function service that retrieves country information given the country name from https://restcountries.eu. It then goes through a Switch state which looks at the provided country population size. The switch state is very simple with just two conditions, namely if population size is less than 20000000 it classifies it as “Small/Large”, and if greater than 20000000 it classifies it as “Large”. The workflow send the information to a classification service to store the data before it finishes execution.
You will need:
When using native image compilation, you will also need:
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-service-calls-quarkus-runner
After starting the example application you can access the AngularJS page at:
http://localhost:8080/
You should see the following page:
Enter a name of a country in the “Name” text input box (e.g “Germany”, “Greece”, “USA”, etc) and press the “Classify” button.
This will call the serverless workflow passing it the name of the country you entered. The workflow will execute and the Country Information portion of the page will refresh showing the classification results, for example: