Skip to content

.NET microservice that comply with the CQRS and Event Sourcing pattern, supported by following technologies: MS SQL Server, MongoDB, Apache Kafka.

Notifications You must be signed in to change notification settings

eliasjurado/dotnet-kafka-cqrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotnet-kafka-cqrs

.NET microservice that comply with the CQRS and Event Sourcing pattern, that means:

  • Command
  • Event
  • Query Technologies: Docker, MS SQL Server, MongoDB, Apache Kafka.

Event Driven Architecture

Setup

1. NET 6 SDK

2. IDE or Code Editor

3. VS Code Extensions

4. Postman

5. Docker

# Once installed, check Docker version:
docker --version

6. Create Docker Network - techbankNet

# Run following command in docker
docker network create --attachable -d bridge mydockernetwork

7. Install or init docker compose

8. Apache Kafka

  • Create docker-compose.yml file with contents:
version: "3.4"

services:
  zookeeper:
    image: bitnami/zookeeper
    restart: always
    ports:
      - "2181:2181"
    volumes:
      - "zookeeper_data:/bitnami"
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  kafka:
    image: bitnami/kafka
    ports:
      - "9092:9092"
    restart: always
    volumes:
      - "kafka_data:/bitnami"
    environment:
      - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_LISTENERS=PLAINTEXT://:9092
      - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
    depends_on:
      - zookeeper

volumes:
  zookeeper_data:
    driver: local
  kafka_data:
    driver: local
   
networks:
  default:
    name: mydockernetwork
    external: true
  • Then run by executing the following command:
docker-compose up -d

9. MongoDB

  • Run in Docker:
docker run -it -d --name mongo-container \
-p 27017:27017 --network mydockernetwork \
--restart always \
-v mongodb_data_container:/data/db \
mongo:latest

10. Microsoft SQL Server

  • Run in Docker:
docker run -d --name sql-container \
--network mydockernetwork \
--restart always \
-e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=$tr0ngS@P@ssw0rd02' -e 'MSSQL_PID=Express' \
-p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest-ubuntu 

About

.NET microservice that comply with the CQRS and Event Sourcing pattern, supported by following technologies: MS SQL Server, MongoDB, Apache Kafka.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages