Apache Kafka API

There are five types of Kafka APIs

  1. Producer API

  2. Consumer API

  3. Admin Client API

  4. Streams API

  5. Connector API

  1. Producer API

  2. 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'
  3. Consumer API

  4. 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).

  5. Admin Client API

  6. 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).

  7. Streams API

  8. 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.

    Maven Dependency of kafka-streams

    <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>
    

    Gradle Dependency of kafka-clients

    implementation group: 'org.apache.kafka', name: 'kafka-streams', version: '3.7.0'
  9. Connector API

  10. 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.

    Maven Dependency of connect-api

    <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>

    Gradle Dependency of connect-api

    implementation group: 'org.apache.kafka', name: 'connect-api', version: '3.7.0'

In the next topic, you will understand about Kafka Brockers