Menu

Notification Service, Part 4: Idempotent Storage and the Timeline
📰

Notification Service, Part 4: Idempotent Storage and the Timeline

DEV Community: aws·Surhid Amatya·7 days ago
#BwCWZRa8
#devtoaws#devto#dev#notification#unread
Long article (869 words) — no AI summary yet.
Reading 0:00
15s threshold

The in-app timeline is what a user sees when they open the notification list. It has to stay correct when Kafka delivers the same event twice. Newest items go first, the unread count has to be instant, and old items have to clean themselves up. This post covers both halves: how duplicates get rejected, and how the DynamoDB table is shaped.

Part A: Idempotency

Kafka promises at-least-once delivery, not exactly-once. After a restart, a rebalance or a retry, the same event can arrive again. Without protection the user sees duplicates and the unread badge drifts upward.

A deterministic notification ID

The service builds the notification ID from the event's eventId . It hashes the eventId with SHA-256 and keeps the first 32 hex characters. The same event always gives the same ID, so a duplicate is recognisable without a lookup.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.