Apache Kafka API
There are five types of Kafka APIs
Producer API
Consumer API
Admin Client API
Streams API
Connector API
Producer API
-
The Producer API enables developers to write and publish records to Kafka topics.
Read the details of how to create Kafka Producer in Java.
Maven Dependency of the Producer API is kafka-clients
<
dependency
>
<
groupId
> org.apache.kafka <
/groupId
>
<
artifactId> kafka-clients <
/artifactId
>
<
version> 3.7.0 <
/version
>
<
/dependency
>
Gradle Dependency of the Producer API is kafka-clients
implementation group: 'org.apache.kafka', name: 'kafka-clients', version: '3.7.0'
Consumer API
-
The Consumer API helps developers to read data from Kafka topics.
It allows applications to subscribe the topics and process/read the messages.
Read the details of how to create Kafka Consumer in Java.
kafka-clients dependency is required(same as avobe).
Admin Client API
-
The Admin Client API is a Kafka API that helps developers to manage Kafka clusters programmatically.
It provides functionality that can be used to create, delete, describe, and modify Kafka resources
such as topics, brokers etc.
kafka-clients dependency is required(same as avobe).
Streams API
-
The Kafka Stream API provides the functionalities to application to perform stream processing
which consumes an input stream from one or more topics, and produce an output stream to one or more output topics.
<
dependency
>
<
groupId
> org.apache.kafka <
/groupId
>
<
artifactId> kafka-clients <
/artifactId
>
<
version> 3.7.0 <
/version
>
<
/dependency
>
<
dependency>
<
groupId> org.apache.kafka <
/groupId>
<
artifactId> kafka-streams <
/artifactId>
<
version> 3.7.0 <
/version>
<
/dependency>
implementation group: 'org.apache.kafka', name: 'kafka-streams', version: '3.7.0'
Connector API
-
The Kafka Connector API manage integration of Kafka Connect with another system, either as an input that ingests data into Kafka
or an output that passes data to an external system. It helps to build and run reusable data import/export connectors that consume or produce
streams of events from to external systems and applications that integrate with Kafka.
<
dependency
>
<
groupId
> org.apache.kafka <
/groupId
>
<
artifactId> kafka-clients <
/artifactId
>
<
version> 3.7.0 <
/version
>
<
/dependency
>
<
dependency>
<
groupId> org.apache.kafka <
/groupId>
<
artifactId> connect-api <
/artifactId>
<
version> 3.7.0 <
/version>
<
/dependency>
implementation group: 'org.apache.kafka', name: 'connect-api', version: '3.7.0'
In the next topic, you will understand about
Kafka Brockers