Skip to content

Latest commit

 

History

History

event-sourcing

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Event sourcing

Record states in a non-destructive way

event-sourcing

Example

We have the following applications:

Running the example

docker-compose up
# Calling this command will consume the message
docker exec -it eventsourcing_kafka_1 /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic events --from-beginning

# Open another terminal session
# Notice in the kafka consumer, the events are appended
curl -i -X POST http://localhost:3000/cats/1/events -d '{"message": "eat"}'
curl -i -X POST http://localhost:3000/cats/1/events -d '{"message": "poop"}'
curl -i -X POST http://localhost:3000/cats/1/events -d '{"message": "annoy owner"}'

Sources