Apache Kafka provides application programming interfaces (API) for Java and Scala, in addition to command-line tooling for management and administration tasks.

The core APIs of Apache Kafka are mentioned below.

Let us see each Kafka APIs with its dependency.


1. Producer API

We can use the Producer API to send stream data to the Kafka topic in the cluster.

We can use the following maven dependency to use the producer API.

<dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>2.6.0</version> </dependency>

2. Consumer API

Using Consumer API, an application can read stream data from the Kafka cluster.

We can use the following maven dependency to use the consumer API.

<dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>2.6.0</version> </dependency>

3. Streams API

Using the Apache Kafka streams client library, we can create the application on which the input and output data would be stored in the Apache Kafka cluster.

We can use the following maven dependency to use the streams.

<dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-streams</artifactId> <version>2.6.0</version> </dependency>

4. Connect API

Using the connect API, we can pull data from the source system and put it in Kafka or push it from Kafka to other sink systems.


5. Admin API

The Admin API is used to manage and inspect topics, brokers, acls, and other Kafka objects.

We can use the following maven dependency to use the admin API.

<dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>2.6.0</version> </dependency>