feat(api): publish creature events to Kafka

Every creature action (adopt, feed, play, sleep, kill, revive, delete) and
natural deaths from the decay loop are published to the tamagotchi.events
topic. Best effort: the database stays the source of truth and Kafka being
unavailable never fails a request. Disabled when KAFKA_BROKERS is unset.
This commit is contained in:
kaliouich committed 2026-10-25 20:38:11 +00:00
1 parent 501f6864cd
commit 318523270c
5 files changed
+127 -2

No files matched your search

+22
View File
@@ -36,3 +36,25 @@ spec:
value: <YOUR_DB_PASSWORD>
- name: DECAY_INTERVAL_MS
value: "15000"
# Publication des evenements vers Kafka (api/events.js). Mot de
# passe et CA copies depuis le ns kafka (scripts/copy-kafka-secrets.sh
# du depot showroom).
- name: KAFKA_BROKERS
value: showroom-kafka-bootstrap.kafka.svc:9093
- name: KAFKA_USER
value: tamagotchi-producer
- name: KAFKA_PASSWORD
valueFrom:
secretKeyRef:
name: kafka-producer-credentials
key: password
- name: KAFKA_CA_FILE
value: /etc/kafka/ca.crt
volumeMounts:
- name: kafka-ca
mountPath: /etc/kafka
readOnly: true
volumes:
- name: kafka-ca
secret:
secretName: kafka-cluster-ca