What is Apache Kafka?Why Kafka?Explain about Architecture of Kafka

Apache Kafka is one of the distributed publisher-subscriber system or a distributed messaging system.




i.e. By accepting the message from different producers in a streaming fashion deliver the same messages to the distributed consumer.

Apache Kafka opens source stream processing platform for developers and it is written Functional Programming and Object oriented languages.

Kafka is a message broker between Producer and Consumer with less time sending message.

The architecture of Apache Kafka see in the below diagram:

Topics

Messages

 

Producer: Producer is a process which will publish to message through Kafka broker.

Consumer: Consumer is a process which will consume or receives the message from Kafka broker.

Topic: The fields of the message will be inscribed in a topic.

Kafka Cluster: It will maintain the different brokers which are responsible for the smooth flow of the message passing between producers and consumers.

How to Installation Apache Kafka on Ubuntu simple steps:

Without Zookeeper, there is no Kafka. It means that first Install Zookeeper then will go with Kafka Installation.

Zookeeper is a centralized service for distributed systems to key, value store. It provides configurations for centralized systems.

Start the Kafka server using below commands in command prompt

Kafka/bin > zookeeper-server start.sh config/zookeeper.properties

Kafka/bin > zookeeper-server start.sh config/server.properties

How to create a topic in Kafka using below commands

Kafka/bin > Kafka-topics.sh –create –zookeeper localhost:2181  –replication -factor 1 –topic sreekanth




Kafka/bin> Kafka-topics.sh –list –zookeeper localhost:2181

Create a topic in Producer console:

Kafka/bin > Kafka -console-producer.sh –broker-list localhost:9092 –topic sreekanth

Hello Apache Kafka is entered my message

Kafka/bin > Kafka -console-consumer.sh –broker-list localhost:9092 –topic sreekanth –from beginning

Hello Apache Kafka is entering after your message in Consumer console