Coder Social home page Coder Social logo

vishnugurudathan / cqrs-event-sourcing-springboot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 438 KB

Implementing a Command Query Responsibility Segregation (CQRS) Architecture with Spring Boot and Axion Server

License: GNU General Public License v3.0

Kotlin 5.68% Java 94.32%

cqrs-event-sourcing-springboot's Introduction

CQRS and Event Sourcing Implementation with Spring Boot and Axon Server

This repository contains an implementation of the Command Query Responsibility Segregation (CQRS) architecture using Spring Boot and Axon Server. The implementation includes Event Sourcing, which enables auditing and reconstructing of the aggregate state. The implementation is divided into three services: order-command-service, order-query-service, and payment-service.

Services

  • order-command-service: This service is responsible for handling commands for creating and updating orders. It publishes events to Axon Server and sends a payment request to the payment-service via Kafka.

  • order-query-service: This service is responsible for handling queries related to orders. It subscribes to the events published by order-command-service on Axon Server and updates its own database accordingly.

  • payment-service: This service is responsible for handling payment requests received from the order-command-service via Kafka. It publishes payment events to Axon Server.

Kafka Setup

To run Kafka, you can use the Docker Compose file included in this repository.

docker-compose up -d

Getting Started

To run the application, you need to have Java and Grade installed on your machine. Then, follow these steps:

  1. Clone the repository to your local machine
  2. Navigate to the project directory in the terminal/command prompt
  3. Run the following command: mvn clean spring-boot:run

The services will be available at the following ports:

`order-command-service`: `http://localhost:8080`
`order-query-service`: `http://localhost:8090`
`payment-service`: `http://localhost:9000`

Overview

The implementation follows the CQRS pattern, separating the read and write models. The write model is responsible for handling commands and generating events, which are then persisted to the event store. The read model is responsible for handling queries and returning the current state of the aggregates.

Axon Server is used as the messaging and event store platform, while Spring Boot provides the necessary infrastructure for building and running the application.

cqrs-event-sourcing-springboot's People

Contributors

vishnugurudathan avatar

Watchers

 avatar

Forkers

jmccar

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.