Site icon DataFlair

Apache Kafka Workflow | Kafka Pub-Sub Messaging

Apache Kafka Workflow

Apache Kafka Workflow

Free Kafka course with real-time projects Start Now!!

In our last Kafka tutorial, we discussed Kafka Docker. Today, we will discuss Kafka Workflow.  Also, we will cover Workflow of Pub-Sub Messaging along with Workflow of Queue Messaging / Consumer Group in detail. Also, we will see the role of ZooKeeper in Apache Kafka.

So, let’s start with Kafka Workflow.

What is Kafka Workflow?

In Kafka Workflow, Kafka is the collection of topics which are separated into one or more partitions and partition is a sequence of messages, where index identifies each message (also we call an offset). However, in a Kafka cluster, all the data is the disjoint union of partitions.

The incoming messages are present at the end of a partition, hence consumer can read them. Also, by replicating the messages to different brokers, it maintains durability.

In a very fast, reliable, persisted, fault-tolerance and zero downtime manner, Kafka offers a Pub-sub and queue-based messaging system. Moreover, producers send the message to a topic and the consumer can select any one of the message systems according to their wish.

Workflow of Pub-Sub Messaging

In Apache Kafka, the stepwise workflow of the Pub-Sub Messaging is:

Workflow of Kafka Queue Messaging/Consumer Group

A group of Kafka consumers having the same Group ID can subscribe to a topic, instead of a single consumer, in a queue messaging system.

However, with the same Group ID all consumers, those are subscribing to a topic are considered as a single group and share the messages. This system’s workflow is:

Role of ZooKeeper in Apache Kafka

Apache Zookeeper serves as the coordination interface between the Kafka brokers and consumers. Also, we can say it is a distributed configuration and synchronization service.

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

Basically, ZooKeeper cluster shares the information with the Kafka servers. Moreover, Kafka stores basic metadata information in ZooKeeper Kafka, such as topics, brokers, consumer offsets (queue readers) and so on.

In addition, failure of Kafka Zookeeper/broker does not affect the Kafka cluster. It is because the critical information which is stored in the ZooKeeper is replicated across its ensembles. Then Kafka restores the state as ZooKeeper restarts, leading to zero downtime for Kafka.

However, Zookeeper also performs leader election between the Kafka brokers, in the cases of leadership failure.

Hence, this was all about Apache Kafka Workflow. Hope you like our explanation.

Conclusion

Hence, we have seen the concept of Apache Kafka Workflow. Moreover, in this Kafka Workflow tutorial, we have discussed Workflow of Pub-Sub Messaging system, as well as the workflow of Kafka Queue Messaging system.

Finally, we saw the role of Zookeeper in Apache Kafka. Still, if any doubt occurs regarding Kafka Workflow, feel free to ask in the comment section.

Exit mobile version