Giter VIP home page Giter VIP logo

demo-cqrs-kafka's Introduction

Demo for CQRS with Spring Boot, Apache Kafka and Mongo

Java CI with Maven License: MIT

The main propose of this project is test CQRS with Event Sourcing. This project consists in two spring boot microservices, one to command and other to query. Additionally we deploy and run docker containers for two Mongo databases, an Apache kafka message broker and Apache Zookeeper.

In the next diagram we can show how this project was designed:

diagram

Starting ๐Ÿš€

Requirements ๐Ÿ“‹

To install and run this project you may be installes next requirements:

  • jdk8
  • maven
  • docker and docker-compose

Installation ๐Ÿ”ง

To generate jar files run the following command in root path:

mvn clean package

Run containers of Apache Kafka, Zoookeper and Mongo.

docker-compose up -d

Wait a minute, when you see all containers running yo can launch the Spring Boot microservices:

Microservice for command

Run the following command:

java -jar demo-command/target/demo-command-0.0.1-SNAPSHOT.jar.original

Microservice for query

In other terminal run the following command:

java -jar demo-query/target/demo-query-0.0.1-SNAPSHOT.jar.original

Running project โš™๏ธ

Once all microservice started you can test this service using the command endpoint and service endpoint. I show you one example for POST and GET http rest requests with curl command:

curl --location --request POST 'localhost:8081/phone' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "iphone11",
    "model": "11",
    "color": "red",
    "price": 800.99
}'
curl --location --request GET 'localhost:8082/phone/iphone08'

demo-cqrs-kafka's People

Contributors

drubioa 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.