Diego Rubio Abujas d72a2254dd Update README.md
2020-11-27 16:45:31 +01:00
2020-11-25 23:36:16 +01:00
2020-11-27 11:37:01 +01:00
2020-11-26 00:38:39 +01:00
2020-11-27 09:33:04 +01:00
2020-11-27 09:33:04 +01:00
2020-11-27 16:45:31 +01:00

GitHub Actions status

Demo for CQRS with Spring Boot Projects and Apache Kafka

The main propose of this project is test CQRS with Event Sourcing.

Getting Started

This project consist of two microservices developed with Spring Boot (Once for Command Service and other for Query Services). Each of them has H2 database for Command and Query.

Microservice Command

Once request for POST new Item, after data was inserted in database, it will publish message in kafka broker.

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

Microservice Query

Next the query service Kafka Listener will recive the message and save the new item in query H2 database. In addition we have a endpoint for get Items presents in query database.

This funcionality could be test made POST request to add new Phone in command service.

curl --location --request GET 'localhost:8083/phone/iphone12'

Esta llamada puede devolver 404 en caso de que no exista el teléfono, o bien 200 y el json con información del dispositivo.

Screenshot

Requirements

  • Docker and docker-compose

Install

For make this demo we dispose of docker-compose.yml. This yaml raise up containers with kafka, zookeepr, a container with query spring-boot project and other with command spring boot project.

docker-compose up -d
Description
Demo of CQRS and Event Sourcing with Spring Boot, h2 database, microservices and kafka broker
Readme 708 KiB
Languages
Java 98.4%
JavaScript 1.6%