Blog
Thoughts on engineering, design, and building great products.
Counting Clicks Safely: Idempotency, DLQ, and Partial Batch Failure
Turn the logging consumer from the previous article into a real aggregator. Insert SQS between EventBridge and Lambda for batching, retry, and a dead-letter queue, count clicks into DynamoDB with a transaction that both increments counters and prevents double-counting in one atomic operation, and report failures per message so only the broken one is retried. Real tests: a duplicate event counts once, a failing event lands in the DLQ.
EventBridge: Decoupling Click Recording from the Redirect Path
Opening the event-driven part. Instead of counting clicks right inside the redirect handler, every link open publishes an event onto a custom EventBridge event bus, and a separate consumer handles it. Build the bus, have resolve publish the event, attach a consumer via an event pattern, then open a real link to watch the event flow through the bus to the consumer.