-
-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ac4a08
commit 97b99a0
Showing
4 changed files
with
171 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
Sample/Helpdesk.Wolverine/Helpdesk.Api/Core/Http/AcceptedResponse.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[](https://twitter.com/oskar_at_net) [](https://github.com/sponsors/oskardudycz/) [](https://event-driven.io/?utm_source=event_sourcing_jvm) [](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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:[email protected]} | ||
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: |