This example contains a simple workflow service that illustrate JQ expression usage. The service is described using JSON format as defined in the CNCF Serverless Workflow specification. The service accepts an array of complex numbers (x being the real coordinate and y the imaginary one) and return the square of the max real coordinate.
You will need:
When using native image compilation, you will also need:
mvn clean package 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-expression-quarkus-{version}-runner
The service based on the JSON workflow definition can be access by sending a request to http://localhost:8080/expression' with following content
{ "workflowdata": { "numbers": [ { "x": 2, "y": 1 }, { "x": 4, "y": 3 } ] } }
Complete curl command can be found below:
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"workflowdata":{"numbers":[{"x":2, "y": 1},{"x":4, "y": 3}]}}' http://localhost:8080/expression
And the returned data will be something similar to
{ "id": "9f30a25e-61d4-4e80-bc7c-eb04db51564c", "workflowdata": { "result": 2.0 } }