Skip to content

Commit

Permalink
feat: event sourcing, eda
Browse files Browse the repository at this point in the history
  • Loading branch information
fadyat committed Oct 10, 2023
1 parent b06e747 commit a2cd557
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
4 changes: 3 additions & 1 deletion courses/itmo-software-design/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Lectures

- [Domain Driven Design](./domain-driven-design.md)
- [Event Driven Architecture](./event-driven-architecture.md)
- [Event Driven Architecture](./event-driven-architecture.md)
- [Consistent Hashing](./consistent-hashing.md)
- [Load Balancing](./load-balancing.md)
Binary file added courses/itmo-software-design/docs/eda/eda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 45 additions & 1 deletion courses/itmo-software-design/event-driven-architecture.md
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
# todo
## Event-driven architecture

**Event sourcing** - is a pattern that uses an append-only event log to store the full history of actions taken on data
in a domain.

![](./docs/eda/event-sourcing.png)

The application state is derived by replaying the events in the log.
> This allows the state to be rebuilt at any point in time by replaying the events from the event log.
Common example of event sourcing is a Git.

**Event** - is a record of something that has happened in the domain.
> Event is a subset of the message.
>
> - Event don't have a destination.
> - Event is a named fact that something has happened.
>
> E.g: order created, order shipped, order cancelled.
**Event log** - is a sequence of events that happened in the domain.

**Event driven architecture** - is a pattern that uses events to trigger and communicate between decoupled services.
> Usually implemented using a message broker, such as Kafka or RabbitMQ.
- EDA is asynchronous, which means that the sender and receiver of the message don't need to interact
instantly, events can be processed at a later time.
- We can have multiple consumers of the same event, each consumer can do something different with it. (pub/sub model)
- Easy to add new services, low coupling between services.
- High system reliability, because if one service is down, the event will be stored in the event log
and will be processed later.

![](./docs/eda/eda.png)

**CQRS** (Command Query Responsibility Segregation) - is a pattern that separates the read and write operations
for a data store.

> Different services can handle read and write operations separately.
### Resources

- https://aws.amazon.com/ru/event-driven-architecture/
- https://www.linkedin.com/pulse/event-sourcing-pattern-distributed-designpatterns-pratik-pandey/
- https://docs.axoniq.io/reference-guide/architecture-overview/event-sourcing
- https://microservices.io/patterns/data/saga.html
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2cd557

Please sign in to comment.