-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
7c2420f
commit 262b4f5
Showing
24 changed files
with
87 additions
and
50 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
workshops/introduction_to_event_sourcing/.vscode/Node.js.code-profile
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[![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) | ||
[<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![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) | ||
|
||
# Introduction to Event Sourcing Self-Paced Kit | ||
|
||
|
@@ -10,7 +10,7 @@ The emphasis will be on a pragmatic understanding of architectures and applying | |
|
||
You can do the workshop as a self-paced kit. That should give you a good foundation for starting your journey with Event Sourcing and learning tools like EventStoreDB. | ||
|
||
**If you'd like to get full coverage with all nuances of the private workshop, check [training page on my blog for more details](https://event-driven.io/en/training/) feel free to contact me via [email](mailto:oskar[email protected]).** | ||
**If you'd like to get full coverage with all nuances of the private workshop, check [training page on my blog for more details](https://event-driven.io/en/training/) feel free to contact me via [email](mailto:oskar@event-driven.io).** | ||
|
||
Read also more in my article [Introduction to Event Sourcing - Self Paced Kit](https://event-driven.io/en/introduction_to_event_sourcing/?utm_source=event_sourcing_nodejs). | ||
|
||
|
@@ -21,18 +21,20 @@ Follow the instructions in exercises folders. | |
1. [Events definition](./src/01_events_definition/). | ||
2. [Getting State from events](./src/02_getting_state_from_events/). | ||
3. Appending Events: | ||
- [EventStoreDB](./src/03_appending_events_eventstoredb/) | ||
- [Raw EventStoreDB](./src/03_appending_events_eventstoredb/) | ||
- [Emmett with various storages (PostgreSQL, EventStoreDB, MongoDB)](./src/04_appending_events_emmett/) | ||
4. Getting State from events | ||
- [EventStoreDB](./src/04_getting_state_from_events_eventstoredb/) | ||
5. [Business logic](./src/05_business_logic/) | ||
- [Raw EventStoreDB](./src/05_getting_state_from_events_eventstoredb/) | ||
- [Emmett with various storages (PostgreSQL, EventStoreDB, MongoDB)](./src/06_getting_state_from_events_emmett/) | ||
5. [Business logic](./src/07_business_logic/) | ||
6. Application logic: | ||
- [EventStoreDB](./src/06_application_logic_eventstoredb/) | ||
- [EventStoreDB](./src/08_application_logic_eventstoredb/) | ||
7. Optimistic Concurrency: | ||
- [EventStoreDB](./src/07_optimistic_concurrency_eventstoredb/) | ||
- [EventStoreDB](./src/09_optimistic_concurrency_eventstoredb/) | ||
8. Projections: | ||
- [General](./src/08_projections_single_stream/) | ||
- [Idempotency](./src/09_projections_single_stream_idempotency/) | ||
- [Eventual Consistency](./src/10_projections_single_stream_eventual_consistency/) | ||
- [General](./src/10_projections_single_stream/) | ||
- [Idempotency](./src/11_projections_single_stream_idempotency/) | ||
- [Eventual Consistency](./src/12_projections_single_stream_eventual_consistency/) | ||
|
||
## Prerequisites | ||
|
||
|
@@ -51,12 +53,23 @@ Follow the instructions in exercises folders. | |
|
||
## Ensuring that all is setup correctly | ||
|
||
1. Run: `docker compose up` to start EventStoreDB docker image. | ||
1. Run: `docker compose up` to start PostgreSQL, EventStoreDB, MongoDB docker images. | ||
2. Run `npm run test:solved`. If all is fine then all tests should be green. | ||
|
||
## Running | ||
|
||
1. Run: `docker compose up` to start EventStoreDB docker image.You should automatically get EventStoreDB UI: http://localhost:2113/ | ||
1. Tests by default are using TestContainers, but if you'd like to troubleshoot it manually, you can disable the TestContainers and use regular docker images by setting the `ES_USE_TEST_CONTAINERS` environment variable to false: | ||
|
||
```bash | ||
ES_USE_TEST_CONTAINERS=false | ||
``` | ||
|
||
2. Then run: `docker compose up` to start EventStoreDB docker image.You should automatically get: | ||
|
||
- EventStoreDB UI: http://localhost:2113/ | ||
- Mongo Express UI: http://localhost:8081/ | ||
- PgAdmin: http://localhost:5050/ | ||
|
||
2. You can get build watch by running `npm run build:ts:watch`. | ||
3. To run test for exercises run `npm run test:exercise`. For solutions run `npm run test:solved`, for all `npm run test`. | ||
4. Whe you're working with exercise and want to have tests running on file change run `npm run test:exercise:watch`. |
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
26 changes: 19 additions & 7 deletions
26
workshops/introduction_to_event_sourcing/src/04_appending_events_emmett/README.md
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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
# Exercise 03 - Appending events to EventStoreDB | ||
# Exercise 04 - Appending events to Emmett | ||
|
||
Using a defined structure of events from the [first exercise](../01_events_definition/), fill a `appendToStream` function to store events in [EventStoreDB](https://developers.eventstore.com/clients/grpc/). | ||
Using a defined structure of events from the [first exercise](../01_events_definition/), fill a `appendToStream` function to store events in selected Emmet's event storage: | ||
|
||
## Prerequisites | ||
- [EventStoreDB](./eventstoredb/), | ||
- [PostgreSQL](./postgresql/), | ||
- [MongoDB](./mongodb) | ||
|
||
Run [docker compose](../docker-compose.yml) script from the main workshop repository to start EventStoreDB instance. | ||
## Prerequisities | ||
|
||
```shell | ||
docker compose up | ||
1. Tests by default are using TestContainers, but if you'd like to troubleshoot it manually, you can disable the TestContainers and use regular docker images by setting the `ES_USE_TEST_CONTAINERS` environment variable to false: | ||
|
||
```bash | ||
ES_USE_TEST_CONTAINERS=false | ||
``` | ||
|
||
After that you can use EventStoreDB UI to see how streams and events look like. It's available at: http://localhost:2113/. | ||
2. Then run: `docker compose up` to start EventStoreDB docker image.You should automatically get: | ||
|
||
- EventStoreDB UI: http://localhost:2113/ | ||
- Mongo Express UI: http://localhost:8081/ | ||
- PgAdmin: http://localhost:5050/ | ||
|
||
2. You can get build watch by running `npm run build:ts:watch`. | ||
3. To run test for exercises run `npm run test:exercise`. For solutions run `npm run test:solved`, for all `npm run test`. | ||
4. Whe you're working with exercise and want to have tests running on file change run `npm run test:exercise:watch`. |
2 changes: 1 addition & 1 deletion
2
...ction_to_event_sourcing/src/05_getting_state_from_events_eventstoredb/README.md
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
6 changes: 3 additions & 3 deletions
6
...ntroduction_to_event_sourcing/src/06_getting_state_from_events_emmett/README.md
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Exercise 04 - Getting the current entity state from events using EventStoreDB | ||
# Exercise 06 - Getting the current entity state from events using Emmett | ||
|
||
Having a defined structure of events and an entity representing the shopping cart from the [first exercise](../01_events_definition/), fill a `GetShoppingCart` function that will rebuild the current state from events. | ||
|
||
If needed you can modify the events or entity structure. | ||
|
||
There are two variations: | ||
|
||
- using mutable entities: [oop/gettingStateFromEvents.exercise.test.ts](./oop/gettingStateFromEvents.exercise.test.ts), | ||
- using fully immutable structures: [immutable/gettingStateFromEvents.exercise.test.ts](./immutable/gettingStateFromEvents.exercise.test.ts). | ||
- using mutable entities: [./mongodb/oop/gettingStateFromEvents.exercise.test.ts](./oop/gettingStateFromEvents.exercise.test.ts), | ||
- using fully immutable structures: [./mongodb/immutable/gettingStateFromEvents.exercise.test.ts](./immutable/gettingStateFromEvents.exercise.test.ts). | ||
|
||
Select your preferred approach (or both) to solve this use case. If needed you can modify entities or events. |
2 changes: 1 addition & 1 deletion
2
workshops/introduction_to_event_sourcing/src/07_business_logic/README.md
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Exercise 05 - Business Logic | ||
# Exercise 07 - Business Logic | ||
|
||
Having the following shopping cart process: | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../introduction_to_event_sourcing/src/08_application_logic_eventstoredb/README.md
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Exercise 06 - Application Logic | ||
# Exercise 08 - Application Logic | ||
|
||
Having the following shopping cart process: | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...oduction_to_event_sourcing/src/09_optimistic_concurrency_eventstoredb/README.md
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
2 changes: 1 addition & 1 deletion
2
...shops/introduction_to_event_sourcing/src/10_projections_single_stream/README.md
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
2 changes: 1 addition & 1 deletion
2
...uction_to_event_sourcing/src/11_projections_single_stream_idempotency/README.md
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
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
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
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
26 changes: 19 additions & 7 deletions
26
.../introduction_to_event_sourcing/src/solved/04_appending_events_emmett/README.md
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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
# Exercise 03 - Appending events to EventStoreDB | ||
# Exercise 04 - Appending events to Emmett | ||
|
||
Using a defined structure of events from the [first exercise](../01_events_definition/), fill a `appendToStream` function to store events in [EventStoreDB](https://developers.eventstore.com/clients/grpc/). | ||
Using a defined structure of events from the [first exercise](../01_events_definition/), fill a `appendToStream` function to store events in selected Emmet's event storage: | ||
|
||
## Prerequisites | ||
- [EventStoreDB](./eventstoredb/), | ||
- [PostgreSQL](./postgresql/), | ||
- [MongoDB](./mongodb) | ||
|
||
Run [docker compose](../docker-compose.yml) script from the main workshop repository to start EventStoreDB instance. | ||
## Prerequisities | ||
|
||
```shell | ||
docker compose up | ||
1. Tests by default are using TestContainers, but if you'd like to troubleshoot it manually, you can disable the TestContainers and use regular docker images by setting the `ES_USE_TEST_CONTAINERS` environment variable to false: | ||
|
||
```bash | ||
ES_USE_TEST_CONTAINERS=false | ||
``` | ||
|
||
After that you can use EventStoreDB UI to see how streams and events look like. It's available at: http://localhost:2113/. | ||
2. Then run: `docker compose up` to start EventStoreDB docker image.You should automatically get: | ||
|
||
- EventStoreDB UI: http://localhost:2113/ | ||
- Mongo Express UI: http://localhost:8081/ | ||
- PgAdmin: http://localhost:5050/ | ||
|
||
2. You can get build watch by running `npm run build:ts:watch`. | ||
3. To run test for exercises run `npm run test:exercise`. For solutions run `npm run test:solved`, for all `npm run test`. | ||
4. Whe you're working with exercise and want to have tests running on file change run `npm run test:exercise:watch`. |
2 changes: 1 addition & 1 deletion
2
...o_event_sourcing/src/solved/05_getting_state_from_events_eventstoredb/README.md
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
2 changes: 1 addition & 1 deletion
2
...tion_to_event_sourcing/src/solved/06_getting_state_from_events_emmett/README.md
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
2 changes: 1 addition & 1 deletion
2
workshops/introduction_to_event_sourcing/src/solved/07_business_logic/README.md
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Exercise 05 - Business Logic | ||
# Exercise 07 - Business Logic | ||
|
||
Having the following shopping cart process: | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...uction_to_event_sourcing/src/solved/08_application_logic_eventstoredb/README.md
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Exercise 06 - Application Logic | ||
# Exercise 08 - Application Logic | ||
|
||
Having the following shopping cart process: | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...n_to_event_sourcing/src/solved/09_optimistic_concurrency_eventstoredb/README.md
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
2 changes: 1 addition & 1 deletion
2
...ntroduction_to_event_sourcing/src/solved/10_projections_single_stream/README.md
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
2 changes: 1 addition & 1 deletion
2
...to_event_sourcing/src/solved/11_projections_single_stream_idempotency/README.md
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
2 changes: 1 addition & 1 deletion
2
...sourcing/src/solved/12_projections_single_stream_eventual_consistency/README.md
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