The working principle of Kafka follows the below order.
Producers send message to a topic at regular intervals.
Broker in kafka responsible to stores the messages which is available in partitions configured for that topic.
Kafka ensure that if producer publish the two messages, than both the message should be accept by consumer.
Consumer pull the message from the allocated topic.
Once consumer digest the topic than Kafka push the offset value to the zookeeper.
Consumer continuously sending the signal to Kafka approx every 100ms, waiting for the messages.
Consumer send the acknowledgement ,when message get received.
When Kafka receives an acknowledgement, it modified the offset value to the new value and send to the Zookeeper. Zookeeper maintain this offset value so that consumer can read next message correctly even during server outrages.
This flow is continuing repeating until the request will be live.