Posts

Showing posts from 2024

Mastering SpringKafka: Uncovering Partition Creation and Replication Counts

Introduction: "Apache Kafka is a distributed streaming platform that allows you to build real-time data pipelines and streaming apps. It is widely used for its high throughput, fault tolerance, and replication capabilities." In this post, we'll look at a common scenario that many Kafka users encounter, determining the count of partitions and replications for a Kafka topic. Problem Statement: "Imagine you've just joined a new project where Kafka is being used. You need to understand the current configuration of your Kafka topics, specifically, how many partitions and replications have been created. But what if there's no documentation available? Don't worry, there's a way to find out using KafkaAdmin" Technical Terms: KafkaAdmin - Spring Kafka API for communicating with kafka server AdminClient - Apache Kafka API for communicating with kafka server using native client Solution: public List<TopicInfo> getTopicsWithPartitions ( boolean showI...