Record states in a non-destructive way
We have the following applications:
- One app exposing REST endpoints:
- It is exposed at port 3001
- It contains 2 endpoints:
- A Zookeeper
- Kafka to register the events
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"}'