Following is the step wise workflow of the Pub-Sub Messaging −• Producers send message to a topic at regular intervals.• Kafka broker stores all messages in the partitions configured for that particular topic. It ensures the messagesare equally shared between partitions. If the producer sends two messages and there are two partitions, Kafkawill store one message in the first partition and the second message in the second partition.• Consumer subscribes to a specific topic.• Once the consumer subscribes to a topic, Kafka will provide the current offset of the topic to the consumer andalso saves the offset in the Zookeeper.• Consumer will request the Kafka in a regular interval (like 100 Ms) for new messages.• Once Kafka receives the messages from producers, it forwards these messages to the consumers.• Consumer will receive the message and process it.• Once the messages are processed, consumer will send an acknowledgement to the Kafka broker.• Once Kafka receives an acknowledgement, it changes the offset to the new value and updates it in theZookeeper. Since offsets are maintained in the Zookeeper.• This above flow will repeat until the consumer stops the request.• Consumer has the option to rewind/skip to the desired offset of a topic at any time and read all the subsequentmessages