Git Product home page Git Product logo

giftcard-es-axon's Introduction

Event Driven GiftCard Application

This project demonstrate the use of Event Sourcing and CQRS in the context of a Microservices-based system.

This application composed by two services: Command and Query.

  • [Issue/Redeem a Giftcard - Command Service]
  • [View the Cards - Query Service]

This application is also resilient, even when the query service is down but still you can save the state and once the query service is up and running, it pulls all the data from the event store.

Tech Stack

Running

Ensure you have a recent version of Java, Maven, and Axon server 4.x version.

Download the axon server, and run the below command $ java -jar axonserver-4.0.jar

$ cd giftcard-es-axon-microservices
$ mvn clean install
$ mvn -Dserver.port=8081 spring-boot:run -Pcommand
$ cd giftcard-es-axon-microservices
$ mvn -Dserver.port=8082 spring-boot:run -Pquery
$ Issue GiftCard :
localhost:8081/card/1/issue/100/command
$ Redeem GiftCard :
localhost:8081/card/1/redeem/50/command
$ List all the cards
localhost:8082/cards

Simulate resiliency

Stop the Query Service server

$ Issue GiftCard without query service
localhost:8081/card/2/issue/100/command

Now Start the query service
$ mvn -Dserver.port=8082 spring-boot:run -Pquery

$ List all the cards ( Now you will find the updated data)
localhost:8082/cards

To run in Monolithic

[Note: This project can also be run as Monolithic application without Axon Server, 
Just exclude this dependency "axon-server-connector" from "axon-spring-boot-starter"]

$ cd giftcard-es-axon-microservices
$ mvn clean install
$ mvn -Dserver.port=8080 spring-boot:run

giftcard-es-axon's People

Contributors

azeem87 avatar

Stargazers

Gustavo Monti avatar

Watchers

James Cloos avatar  avatar

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.