This guide demonstrates how to create a simple workflow for placing orders using Akka Workflow and Event Sourced Entity components.
- A Akka account
- Java 21 (we recommend Eclipse Adoptium)
- Apache Maven
- Docker Engine
curlcommand-line tool
To understand the Akka concepts behind this example, see Development Process in the documentation.
This project demonstrates the use of Workflow and Event Sourced Entity components. For more information, see Developing Services.
Use Maven to build your project:
mvn compileTo start your service locally, run:
mvn compile exec:java This command will start your Akka service.
- Add product to the inventory
curl -XPATCH -H "Content-Type: application/json" \
--data '{"productId": "p1", "quantity": 50}' \
localhost:9000/inventory/global-inventory- Place an order
curl -XPOST -H "Content-Type: application/json" \
--data '{"userId": "u1", "productId": "p1", "quantity": 10, "price": 10}' \
localhost:9000/order/123 - Check order status
curl localhost:9000/order/123 - Check remaining stocks
curl localhost:9000/inventory/global-inventory/product/p1 - Place an order with payments failure. Payment will fail for an order with an
idset to42.
curl -XPOST -H "Content-Type: application/json" \
--data '{"userId": "u1", "productId": "p1", "quantity": 10, "price": 10}' \
localhost:9000/order/42 - Check order status
curl localhost:9000/order/42 To run the integration tests located in src/it/java:
mvn integration-testIf you encounter issues, ensure that:
- The Akka service is running and accessible on port 9000.
- Your
curlcommands are formatted correctly.
For questions or assistance, please refer to our online support resources.
You can use the Akka Console to create a project and see the status of your service.
Build container image:
mvn clean install -DskipTestsInstall the akka CLI as documented in Install Akka CLI.
Deploy the service using the image tag from above mvn install:
akka service deploy order-workflow order-workflow:tag-name --pushRefer to Deploy and manage services for more information.