You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-22
Original file line number
Diff line number
Diff line change
@@ -25,13 +25,17 @@
25
25
-[Database polling alternative](#4-7-3)
26
26
-[Adding new asynchronous event handlers](#4-8)
27
27
-[Drawbacks](#4-9)
28
-
-[Class diagrams](#4-10)
29
-
-[Class diagram of the domain model](#4-10-1)
30
-
-[Class diagram of the projections](#4-10-2)
31
-
-[Class diagram of the service layer](#4-10-3)
32
-
-[How to run the sample?](#5)
33
-
34
-
<!-- Table of contents is made with https://github.com/evgeniy-khist/markdown-toc -->
28
+
-[Project structure](#5)
29
+
-[Gradle subprojects](#5-1)
30
+
-[Database schema migrations](#5-2)
31
+
-[Class diagrams](#5-3)
32
+
-[Class diagram of the domain model](#5-3-1)
33
+
-[Class diagram of the projections](#5-3-2)
34
+
-[Class diagram of the service layer](#5-3-3)
35
+
-[How to adapt it to your domain?](#6)
36
+
-[How to run the sample?](#7)
37
+
38
+
<!-- Table of contents is made with https://github.com/eugene-khyst/md-toc-cli -->
35
39
36
40
## <aid="1"></a>Introduction
37
41
@@ -62,16 +66,17 @@ But PostgreSQL, the world's most advanced open-source database, is also suitable
62
66
You can use PostgreSQL as an event store without additional frameworks or extensions
63
67
instead of setting up and maintaining a separate specialized database for event sourcing.
64
68
65
-
This repository provides a reference implementation of an event-sourced system that uses PostgreSQL as an event store.
66
-
You can also [fork](https://github.com/evgeniy-khist/postgresql-event-sourcing/fork) the repo
67
-
and use it as a template for your projects.
69
+
This repository provides a reference implementation of an event-sourced system
70
+
that uses PostgreSQL as an event store built with Spring Boot.
71
+
[Fork](https://github.com/eugene-khyst/postgresql-event-sourcing/fork) the repository and use it as a template for your projects.
72
+
Or clone the repository and run end-to-end tests to see how everything works together.
68
73
69
74

70
75
71
76
See also
72
77
73
-
*[Event Sourcing with EventStoreDB](https://github.com/evgeniy-khist/eventstoredb-event-sourcing)
74
-
*[Event Sourcing with Kafka and ksqlDB](https://github.com/evgeniy-khist/ksqldb-event-souring)
78
+
*[Event Sourcing with EventStoreDB](https://github.com/eugene-khyst/eventstoredb-event-sourcing)
79
+
*[Event Sourcing with Kafka and ksqlDB](https://github.com/eugene-khyst/ksqldb-event-souring)
75
80
76
81
## <aid="2"></a>Example domain
77
82
@@ -483,7 +488,7 @@ This mechanism is used by default as more efficient.
483
488
After restarting the backend, existing subscriptions will only process new events after the last processed event
484
489
and not everything from the first one.
485
490
486
-
> [!WARNING]
491
+
> **WARNING**
487
492
> Critical content demanding immediate user attention due to potential risks.
488
493
New subscriptions (event handlers) in the first poll will read and process all events.
489
494
Be careful, if there are too many events, they may take a long time to process.
@@ -508,43 +513,72 @@ Using PostgreSQL as an event store has a lot of advantages, but there are also d
508
513
and events created by all later transactions will be read by the event subscription processor
509
514
only after this long-running transaction is committed.
510
515
511
-
### <a id="4-10"></a>Class diagrams
516
+
## <a id="5"></a>Project structure
517
+
518
+
### <a id="5-1"></a>Gradle subprojects
512
519
513
520
This reference implementation can be easily extended to comply with your domain model.
514
521
515
-
#### <a id="4-10-1"></a>Class diagram of the domain model
522
+
Event sourcing related code and application specific code are located in separate Gradle subprojects:
523
+
* [`postgresql-event-sourcing-core`](postgresql-event-sourcing-core): event sourcing and PostgreSQL related code, a shared library, `eventsourcing.postgresql` package,
524
+
* [`event-sourcing-app`](event-sourcing-app): application specific code, a simplified ride-hailing sample, `com.example.eventsourcing` package.
525
+
526
+
`event-sourcing-app` depends on `postgresql-event-sourcing-core`:
# Replace CLUSTER_ID with a unique base64 UUID using "bin/kafka-storage.sh random-uuid"
51
+
# See https://docs.confluent.io/kafka/operations-tools/kafka-tools.html#kafka-storage-sh
52
+
CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk'
51
53
ports:
52
54
- "9092:9092"
53
55
- "9101:9101"
54
56
volumes:
55
57
- kafka-data:/var/lib/kafka/data
56
-
- ./kafka/update_run.sh:/tmp/update_run.sh
57
-
command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'"
Copy file name to clipboardExpand all lines: event-sourcing-app/src/main/java/com/example/eventsourcing/controller/RestResponseEntityExceptionHandler.java
0 commit comments