CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-kafka--kafka-2-13

Apache Kafka is a distributed event streaming platform that combines publish-subscribe messaging, durable storage, and real-time stream processing capabilities.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

Apache Kafka 4.1.1

Apache Kafka is a distributed event streaming platform that provides three key capabilities:

  1. Message Broker: Publish and subscribe to streams of events with high throughput and low latency
  2. Durable Storage: Store streams of events reliably for as long as needed
  3. Stream Processing: Process streams of events in real-time or retrospectively

Package Information

Maven Coordinates:

<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.13</artifactId>
    <version>4.1.1</version>
</dependency>

For client-only applications (Producer/Consumer):

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

Quick Start

Get started quickly with Kafka:

  • Quick Start Guide - Get up and running in minutes
  • Real-World Scenarios - Complete application examples

API Selection Guide

APIUse WhenKey Features
ProducerPublishing events to topicsHigh throughput, exactly-once, transactions
ConsumerReading events from topicsConsumer groups, offset management, ShareConsumer
AdminManaging cluster resourcesTopic/config management, monitoring
StreamsReal-time stream processingStateful transformations, exactly-once, DSL
ConnectIntegrating external systemsPre-built connectors, schema management

Decision Guide

Use Producer API when:

  • Publishing events to Kafka topics
  • Need high throughput message ingestion
  • Require exactly-once semantics with transactions
  • Building data pipelines that write to Kafka

Use Consumer API when:

  • Reading events from Kafka topics
  • Need consumer group coordination for load balancing
  • Require at-least-once or exactly-once consumption
  • Building microservices that react to events

Use ShareConsumer API (New in 4.1.1) when:

  • Multiple consumers need to process from same partitions cooperatively
  • Need explicit record acknowledgement (ACCEPT/RELEASE/REJECT)
  • Implementing work queue patterns with automatic retry
  • Require delivery count tracking for dead-letter queues

Use Admin API when:

  • Managing Kafka cluster resources programmatically
  • Automating topic/configuration operations
  • Monitoring consumer groups and lag
  • Building operational tools and dashboards

Use Streams API when:

  • Processing data in real-time as it flows through Kafka
  • Need stateful transformations and aggregations
  • Building stream processing applications
  • Require exactly-once processing guarantees end-to-end

Use Connect API when:

  • Integrating Kafka with external systems (databases, filesystems, etc.)
  • Need pre-built connectors for common systems
  • Building reusable data integration components
  • Require schema management and data transformation

Core APIs

Client APIs

  • Producer API - Publish streams of records to Kafka topics

    • Thread-safe, asynchronous sending
    • Exactly-once semantics with transactions
    • Custom partitioning strategies
  • Consumer API - Subscribe to topics and process streams of records

    • Consumer groups for load balancing
    • Manual and automatic offset management
    • ShareConsumer for cooperative consumption (New in 4.1.1)
  • Admin API - Manage Kafka resources programmatically

    • Topic management (create, delete, describe, configure)
    • Consumer group management and monitoring
    • ACL and quota management

Streams API

Connect API

Common Components

Core Imports Reference

Producer

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.ProducerConfig;

Consumer

import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.ConsumerConfig;

Admin

import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.admin.CreateTopicsResult;

Streams

import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsBuilder;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.KTable;

Connect

import org.apache.kafka.connect.source.SourceConnector;
import org.apache.kafka.connect.source.SourceTask;
import org.apache.kafka.connect.sink.SinkConnector;
import org.apache.kafka.connect.sink.SinkTask;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.Struct;

Quick Reference Tables

Producer Configuration Presets

PresetUse CaseKey Settings
High ThroughputBatch processingbatch.size=65536, linger.ms=20, compression.type=lz4
Low LatencyReal-timebatch.size=1, linger.ms=0, compression.type=none
High DurabilityCritical dataacks=all, enable.idempotence=true, transactional.id=<id>

Consumer Configuration Presets

PresetUse CaseKey Settings
High ThroughputBatch processingfetch.min.bytes=10240, max.poll.records=1000
Low LatencyReal-timefetch.min.bytes=1, fetch.max.wait.ms=10
Exactly-OnceCritical dataisolation.level=read_committed, enable.auto.commit=false

Streams Configuration Presets

PresetUse CaseKey Settings
High ThroughputLarge-scale processingnum.stream.threads=4, cache.max.bytes.buffering=10485760
Exactly-OnceCritical dataprocessing.guarantee=exactly_once_v2
Low LatencyReal-timecommit.interval.ms=100, cache.max.bytes.buffering=0

Common Patterns

Exactly-Once Semantics

// Producer with transactions
props.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "my-transactional-id");
props.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);

Producer<String, String> producer = new KafkaProducer<>(props);
producer.initTransactions();

producer.beginTransaction();
producer.send(record);
producer.commitTransaction();

Consumer Groups

// Multiple consumers coordinate through consumer groups
props.put(ConsumerConfig.GROUP_ID_CONFIG, "my-group");

Consumer<String, String> consumer = new KafkaConsumer<>(props);
consumer.subscribe(Arrays.asList("my-topic"));

Stateful Stream Processing

// Kafka Streams with state stores
StreamsBuilder builder = new StreamsBuilder();
KTable<String, Long> counts = builder.stream("input")
    .groupByKey()
    .count(Materialized.as("counts-store"));

Documentation Structure

Guides

Step-by-step instructions for common workflows:

Examples

Real-world scenarios and use cases:

Reference

Detailed API specifications and configuration:

API Documentation

Comprehensive API references:

Common Components

Shared functionality across APIs:

Key Features

New in 4.1.1

  • ShareConsumer API - Cooperative partition consumption
  • Share Groups - Support in Admin API
  • Enhanced Transactions - Improved exactly-once semantics

Core Capabilities

  • High Throughput - Millions of messages per second
  • Low Latency - Sub-millisecond latencies
  • Durability - Configurable replication and persistence
  • Scalability - Horizontal scaling with partitions
  • Exactly-Once - End-to-end exactly-once semantics
  • Stream Processing - Built-in stream processing library

Troubleshooting

Common issues and solutions:

Performance Optimization

Quick optimization guides:

Security

Kafka provides comprehensive security features:

  • SSL/TLS - Encryption and certificate-based authentication
  • SASL - PLAIN, SCRAM, GSSAPI (Kerberos), OAUTHBEARER
  • ACLs - Fine-grained authorization

See common/security.md for complete security documentation.

Version Information

  • Version: 4.1.1
  • Scala Version: 2.13
  • Java Requirement: 8+
  • License: Apache-2.0

Migration Notes:

  • ShareConsumer requires broker version 4.0+
  • Exactly-once-v2 recommended over exactly-once (deprecated)
  • New consumer group protocol available but not default

Additional Resources

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.apache.kafka/kafka_2.13@4.1.x
Publish Source
CLI
Badge
tessl/maven-org-apache-kafka--kafka-2-13 badge