Skip to content

akka/akka-order-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akka Order Workflow

This guide demonstrates how to create a simple workflow for placing orders using Akka Workflow and Event Sourced Entity components.

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

  • 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 id set to 42.
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 

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-workflow order-workflow:tag-name --push

Refer to Deploy and manage services for more information.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages