System Design-Distributed Messaging Queue- RabbitMQ and Kafka
UseCase: Asynchronous
Advantage: Less latency
UseCase: Retry/Circuit breaker
UseCase: Pace matching
Point2Point Vs PubSub
P2P - one message can be consume by one consumer at a time
PubSub- one message can be consumed by many consumers
Kafka Architecture
Partition 0 in topic A can communicate with only one consumer in CG1 only at a time but it can communicate with other CG2
Cluster Vs ZooKeeper-
list of topics is cluster
communication between topics take care by zoo keeper
Message:-
Key-
Value- Actual msg -mandatory
Partition-
Topic- mandatory
Consumer have below information
Consumer No
Consumer grp
Topic no
Partion no
Offset no- stating that this mush consumer have read.
Use of offset: If the consumer goes down then the next consumer will read the message and check the offset that from where i need to read the message. and hence consumer group is required.
what happen if the message read failes.
the consumer retry till max limit after that it pull the message in the dead letter queue.
Kafka vs Rabbit MQ
-> Kafka consumer pulls the messsage from Q
->Rabbit MQ push the message to consumer
RABBIT MQ
FANOUT->Broadcast the message to all the Queue
DIRECTEXCHANGE->Exactly matching(message key=routing key)
TOPIC Exchange -> Wild card matching
If consumer is not able to process the message and it failed or not able to process and it will reque it again. If thresold then still not processed then it will put it in the dead letter Q.
Comments
Post a Comment