This is the lab repository for the Practical Event-Sourcing with C# hands-on session. The workshop is taught by Alexey and Sergio. Feel free to ping us if you have questions after the session or feedback to improve it.
Due to the time limitation, there are many aspects of event-sourcing, which we will not be able to cover. Some reference materials will be included in this file later on, so start the repo to be informed.
- .NET Core 2.1
- C# IDE or editor of your choice (for example Jetbrains Rider, VS Code or Visual Studio 2017)
- Docker Compose
The solution is using C# 7.1 features so if you are using Visual Studio - ensure you have VS 2017. Rider supports the latest C# by default or will ask you if you want to enable it.
Note that Docker Compose might not included to your version of Docker, so you need to download and install it. Docker is a pre-requisite for Docker Compose.
In case you are unable to use Docker Compose, please download the following products:
Important: carefully read this section and ensure that everything works on your machine before the workshop. When using Docker Compose, downloading images requires significant bandwidth and we will not be able to do it during the workshop due to the venue WiFi capacity.
You can run the required infrastructure components by issuing a simple command:
$ docker-compose up
form your terminal command line, whilst being inside the repository rot directory.
It might be a good idea to run the services in detached mode, so you don't accidentally stop them. To do this, execute:
$ docker-compose up -d
To stop all services, from the repository root execute this command:
$ docker-compose stop
Hence that this command does not remove containers so you can run them again using docker-compose up
or docker-compose start
and your data will be retained from the previous section.
If you want to clean up all data, use
$ docker-compose down
This command stops all services and removes containers. The images will still be present locally so when you do docker-compose up
- containers will be created almost instantly and everything will start with clean volumes.
If you are unable or do not with to use Docker Compose, you can download EventStore and RavenDb and the install these products locally. EventStore has no "installation" as such on Windows, you just need to extract the archive and start the executable.
EventStore installation instructions for Ubuntu is located here and instructions for running a Windows instance can be found here.
RavenDb 4 can be downloaded for all platform using the link above.
Please reconsider using Docker Compose, since it is the easiest way to get started without installing anything.
You can use an existing installation of the EventStore and build your read models in a database of your choice but we provide examples only for EventStore and RavenDb. Of course, you should not feel restricted by these limitations and outside the workshop please feel free to experiment with different tools.
The workshop source files are located in the steps
folder and there are several stages:
1_the_beginning
is to get things started2_event_streams
shows how events are being persisted3_read_models
explains how to build read models
The final code is located in the src
folder and it is meant to be close to production quality.
Start with trying to get up the Docker Compose images. Do this before the workshop, you will not have enough time to install everything during the workshop or just before it because the venue WiFi will probably not allow you to complete the process within reasonable time.
Start Docker Compose as described above while at home and check that the images are downloaded and everything starts properly. Check if EventStore and RavenDb respond via http by visiting the administration consoles:
- EventStore, user name is "admin" and password is "changeit"
- RavenDb