This demo project demonstrates more sophisticated use of Akka components to implement a distributed system that uses both Saga flavors: choreography and orchestration.
- A Akka account
- Java 21 (we recommend Eclipse Adoptium)
- Apache Maven
- Docker Engine
curl
command-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 compile
To start your service locally, run:
mvn compile exec:java
This command will start your Akka service.
Create wallet
curl -i -X POST http://localhost:9000/wallet/1/create/100
Get wallet
curl http://localhost:9000/wallet/1
Create cinema show
curl http://localhost:9000/cinema-show/show1 \
-i -X POST \
--header "Content-Type: application/json" \
--data '{"title": "Pulp Fiction", "maxSeats": 10}'
Get cinema show
curl http://localhost:9000/cinema-show/show1
Make reservation
curl http://localhost:9000/cinema-show/show1/reserve \
-i -X PATCH \
--header "Content-Type: application/json" \
--data '{"walletId": "1", "reservationId": "123", "seatNumber": 3}'
Verify wallet balance
curl http://localhost:9000/wallet/1
Verify seat status
curl http://localhost:9000/cinema-show/show1/seat-status/3
To run the integration tests located in src/it/java
:
mvn integration-test
If you encounter issues, ensure that:
- The Akka service is running and accessible on port 9000.
- Your
curl
commands 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 -DskipTests
Install the akka
CLI as documented in Install Akka CLI.
Deploy the service using the image tag from above mvn install
:
akka service deploy order-saga akka-order-saga:tag-name --push
Refer to Deploy and manage services for more information.