Real-Dev-Squad / notification-service

MIT License
0 stars 1 forks source link

How Pub/Sub works #3

Closed prakashchoudhary07 closed 1 year ago

vikhyat187 commented 1 year ago

can you assign this to me? @prakashchoudhary07

vikhyat187 commented 1 year ago

[DRAFT]

Publishers communicate asynchronously with subscribers by producing and sending a message to a topic, which is a logical access point and communication channel. Subscribers (web servers, email addresses, Amazon SQS queues, Lambda functions) consume or receive the message or notification over one of the supported protocols (Amazon SQS, HTTP/S, email, SMS, AWS Lambda) when they are subscribed to the topic.

Sample code (AWS) for creating topics

Sample code SNS

vikhyat187 commented 1 year ago

Kafka vs Rabbit MQ [DRAFT]

Screenshot 2023-02-11 at 10 23 12 PM

While deciding between Apache Kafka vs RabbitMQ, it is to be noted that unlike Kafka, which can keep a large amount of data with minimum overhead, RabbitMQ queues are only quicker when they’re empty.

https://medium.com/analytics-vidhya/apache-kafka-architecture-getting-started-with-apache-kafka-771d69ac6cef https://hevodata.com/learn/kafka-vs-rabbitmq/ https://blog.logrocket.com/kafka-vs-rabbitmq-comparing-node-js-message-brokers/ https://www.notificationapi.com/blog/notification-service-design-with-architectural-diagrams https://tanzu.vmware.com/developer/blog/understanding-the-differences-between-rabbitmq-vs-kafka/ https://www.cloudamqp.com/blog/rabbitmq-use-cases-explaining-message-queues-and-when-to-use-them.html About Kafka https://www.confluent.io/blog/kafka-fastest-messaging-system/


Parameters Kafka RabbitMQ SNS + SQS
Event microservices supports supports supports
Stream processing supports supports (need to explore this) not sure on this
Scale Will be easily scalable will be hard to scale scalable as managed service
Retries Will not support in house retries need to create explicitly supports (need to explore on this) supports dead letter queue
Fifo Not sure Not sure Yes
Delivery latency Less not sure Compared to kafka more
Cost less will be more on scale compared to kafka more
Internal working Stores in disk stores In memory not sure
mechanism poll based push based not sure
vikhyat187 commented 1 year ago

As per discussion with @prakashchoudhary07, we are going with Kafka.