Skip to content

akka/akka-saga-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akka Saga Patterns

This demo project demonstrates more sophisticated use of Akka components to implement a distributed system that uses both Saga flavors: choreography and orchestration.

Prerequisites

Concepts

Designing

To understand the Akka concepts behind this example, see Development Process in the documentation.

Developing

This project demonstrates the use of Workflow and Event Sourced Entity components. For more information, see Developing Services.

Build

Use Maven to build your project:

mvn compile

Run Locally

To start your service locally, run:

mvn compile exec:java

This command will start your Akka service.

Exercising the 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

Run integration tests

To run the integration tests located in src/it/java:

mvn integration-test

Troubleshooting

If you encounter issues, ensure that:

  • The Akka service is running and accessible on port 9000.
  • Your curl commands are formatted correctly.

Need help?

For questions or assistance, please refer to our online support resources.

Deploying

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.

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages