Skip to content

events

Introduction

Event vs Log

Events: business centric, system behaviour
Logs: more technical, operational insights
A signe business operation may generate both, event for business significance, log for technical execution.

Event sourcing

In Event Sourcing, events are central to describe intents (commands) and state changes. It should be the unique source of truth.
Current state are derived from events, as the sum of changes. Current state can be reconstructed by replaying all events from the event store.
Since deriving current state from events is computationaly expensive, states are stored in projections.
CQRS is a pedantic acronym for a simple concept: event producers and consumers should be totally independents.
pros: scalability, cheap writes, support logging/debugging
cons: complexity, eventualy consistent, async paradigm, expensive reads

Domain event

LavinMQ

install (Debian)

# cd /etc/apt/trusted.gpg.d
# curl -L https://packagecloud.io/cloudamqp/lavinmq/gpgkey > lavinmq.asc
# cd /etc/apt/sources.list.d
# echo "deb https://packagecloud.io/cloudamqp/lavinmq/debian <RELEASE> main" > lavinmq.list
# apt update
# apt install lavinmq

config

/etc/lavinmq/lavinmq.ini