Member-only story
Event-Driven Notifications: A Case for Queues Over Kafka Topics
Designing robust and scalable notification services in an Event-Driven Architecture can be challenging. After my last conversation with Rahul, where I helped him understand coupling in microservices (captured in the blog titled “The Cost of Consistency: A Tale of Accidental Coupling in Microservices” available here), we found ourselves discussing another technical challenge over a cup of coffee. Rahul, who is working on such an architecture, narrated a technical problem he was struggling with. He was tasked with designing a notification service for a platform that sends emails to users based on various content interactions, such as likes, comments, and shares. Here’s a detailed explanation of the problem, along with a trade-off analysis that helped us arrive at the best solution.
Context of the Problem
Rahul explained that the platform has several domain services, like a Content Management Service. When users interact with content by liking, commenting, or sharing, emails are sent to the content authors notifying them of these actions. The domain services already emit events for various interactions, and downstream services like analytics consume these events. Rahul’s challenge was to decide whether the notification service should consume these domain events directly from Kafka topics or whether a dedicated point-to-point communication mechanism like a queue should be used.