Giter VIP home page Giter VIP logo

axon-service's Introduction

axon-service

example application using Axon framework with distributed Saga.

this project is moved from the repository xstefank/learning-tests, prior development can be tracked there

Build and running

Docker compose

the esasiest way to run this application:

  1. build

    • mvn clean install
  2. start

    • docker-compose up -d --build
  3. stop

    • docker-compose down --remove-orphans

Manual start

The project consists of three microservices connected throuch spring cloud Eureka server for command dispatching and throuch AMQP queue for event handling.

  1. install service-model jar into local maven repository

    • cd service-model
    • mvn clean install
  2. download and start rabbitmq for your operating system

    • sudo systemctl start rabbitmq-server.service
  3. download and start H2 database

  4. run the Eureka registration server

    • cd registration-server
    • mvn clean package exec:java
    • application runs on the port 8761
  5. in different terminal - run the order service providing the saga management

    • cd order-service
    • mvn clean package exec:java
    • application runs on the port 8080
  6. in different terminal - run the shipment service

    • cd shipment-service
    • mvn clean package exec:java
    • application runs on the port 8081
  7. in different terminal - run the invoice service

    • cd invoice-service
    • mvn clean package exec:java
    • application runs on the port 8082

You should see the registration of the services in registration-server log or you can go to localhost:8761 to check that all services are registered.

After the Spring Cloud sends the heartbeats to all service (need to boot up Axon's distributed command bus) you can test the application by issuing request for order

Testing

After all of the services are registered with the registration-server you can test the example with:

curl -X POST -H "Content-Type: application/json" -d '{"productId":"testProduct", "comment":"testComment", "price":"20"}' http://localhost:8080/api/order

For the compensation scenario you can run:

curl -X POST -H "Content-Type: application/json" -d '{"productId":"failShipment", "comment":"testComment", "price":"20"}' http://localhost:8080/api/order

or

curl -X POST -H "Content-Type: application/json" -d '{"productId":"failInvoice", "comment":"testComment", "price":"20"}' http://localhost:8080/api/order

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.