Skip to content

Commit

Permalink
Added Readme to Wolverine sample
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Feb 6, 2024
1 parent 0ac4a08 commit 97b99a0
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 28 deletions.
4 changes: 4 additions & 0 deletions EventSourcing.NetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reservations", "Sample\HotelManagement\Reservations\Reservations.csproj", "{92DC3F6A-BB06-4E33-A9C7-8262CC68F93C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Helpdesk.Wolverine", "Helpdesk.Wolverine", "{FF4C07DA-9E1F-4FC6-8772-AB82795A3951}"
ProjectSection(SolutionItems) = preProject
Sample\Helpdesk.Wolverine\docker-compose.yml = Sample\Helpdesk.Wolverine\docker-compose.yml
Sample\Helpdesk.Wolverine\README.md = Sample\Helpdesk.Wolverine\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helpdesk.Api", "Sample\Helpdesk.Wolverine\Helpdesk.Api\Helpdesk.Api.csproj", "{D2080C98-8F26-4727-9D49-B68915A4C715}"
EndProject
Expand Down

This file was deleted.

25 changes: 25 additions & 0 deletions Sample/Helpdesk.Wolverine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[![Twitter Follow](https://img.shields.io/twitter/follow/oskar_at_net?style=social)](https://twitter.com/oskar_at_net) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_jvm) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_net)

# Pragmatic Event Sourcing With Marten and Wolverine

It's the extended version of the [Helpdesk sample](../Helpdesk) adding Wolverine into the game.

It has:
- Simplest CQRS and Event Sourcing flow using Wolverine Endpoints,
- Cutting the number of layers to bare minimum,
- Using all Marten helpers like `WriteToAggregate`, `AggregateStream` to simplify the processing,
- Examples of all the typical Marten's projections,
- example of how and where to use C# Records, Nullable Reference Types, etc,
- No Aggregates! Commands are handled in the domain service as pure functions.

You can watch the original webinar on YouTube where I'm explaining the details of the implementation:

<a href="https://www.youtube.com/watch?v=jnDchr5eabI&list=PLw-VZz_H4iiqUeEBDfGNendS0B3qIk-ps&index=1" target="_blank"><img src="https://img.youtube.com/vi/jnDchr5eabI/0.jpg" alt="Pragmatic Event Sourcing with Marten" width="640" height="480" border="10" /></a>

And follow up about Wolverine:

<a href="https://www.youtube.com/watch?v=b-rxOLzevqQ&list=PLw-VZz_H4iiqUeEBDfGNendS0B3qIk-ps&index=9" target="_blank"><img src="https://img.youtube.com/vi/b-rxOLzevqQ/0.jpg" alt="Simplify your architecture with Wolverine" width="640" height="480" border="10" /></a>

or read the articles explaining this design:
- [Slim your aggregates with Event Sourcing!](https://event-driven.io/en/slim_your_entities_with_event_sourcing/?utm_source=event_sourcing_net)
- [Event-driven projections in Marten explained](https://event-driven.io/pl/projections_in_marten_explained/?utm_source=event_sourcing_net)
142 changes: 142 additions & 0 deletions Sample/Helpdesk.Wolverine/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
version: "3"
services:
postgres:
image: clkao/postgres-plv8
container_name: postgres
environment:
POSTGRES_PASSWORD: Password12!
ports:
- "5432:5432"
networks:
- postgres

pgadmin:
image: dpage/pgadmin4
container_name: pgadmin_container
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- "${PGADMIN_PORT:-5050}:80"
networks:
- postgres

#######################################################
# Zookeeper
#######################################################
zookeeper:
image: confluentinc/cp-zookeeper:7.0.1
hostname: zookeeper
container_name: zookeeper
networks:
- kafka_network
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

#######################################################
# Kafka
#######################################################
kafka:
image: confluentinc/cp-kafka:7.0.1
hostname: kafka
container_name: kafka
depends_on:
- zookeeper
networks:
- kafka_network
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
ADVERTISED_HOST_NAME: kafka
KAFKA_ADVERTISED_HOSTNAME: 127.0.0.1

init-kafka:
image: confluentinc/cp-kafka:7.0.1
depends_on:
- kafka
entrypoint: [ '/bin/sh', '-c' ]
networks:
- kafka_network
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafka:29092 --list
echo -e 'Creating kafka topics'
kafka-topics --bootstrap-server kafka:29092 --create --if-not-exists --topic Incidents --replication-factor 1 --partitions 1
echo -e 'Successfully created the following topics:'
kafka-topics --bootstrap-server kafka:29092 --list
"
#######################################################
# Avro Schema Registry
#######################################################
schema_registry:
image: confluentinc/cp-schema-registry:7.0.1
container_name: schema_registry
hostname: schema_registry
ports:
- 8181:8181
- 8081:8081
depends_on:
- zookeeper
networks:
- kafka_network
environment:
SCHEMA_REGISTRY_HOST_NAME: schema_registry
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'
SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS: 'GET,POST,PUT,OPTIONS'
SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_ORIGIN: '*'
SCHEMA_LOG4J_ROOT_LOGLEVEL: 'ERROR'
SCHEMA_TOOLS_LOG4J_LOGLEVEL: 'ERROR'

kafka_rest:
image: confluentinc/cp-kafka-rest:7.0.1
hostname: kafka_rest
ports:
- "8082:8082"
depends_on:
- schema_registry
networks:
- kafka_network
environment:
KAFKA_REST_BOOTSTRAP_SERVERS: kafka:29092
KAFKA_REST_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_REST_SCHEMA_REGISTRY_URL: http://schema_registry:8081
KAFKA_REST_HOST_NAME: kafka_rest
KAFKA_REST_LISTENERS: http://0.0.0.0:8082

kafka_topics_ui:
image: provectuslabs/kafka-ui:latest
hostname: kafka-ui
ports:
- "8080:8080"
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
networks:
- kafka_network
depends_on:
- kafka_rest

networks:
postgres:
driver: bridge
kafka_network:
driver: bridge

volumes:
postgres:
pgadmin:

0 comments on commit 97b99a0

Please sign in to comment.