spring-kafka

Configure Kafka producers and consumers for Java 21 Spring Boot 3.x services.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/zenobiuszeto/banking-strawman-capabilities --skill spring-kafka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-kafka
Source: https://github.com/zenobiuszeto/banking-strawman-capabilities/tree/main/skills/spring-kafka
Command: npx skills add https://github.com/zenobiuszeto/banking-strawman-capabilities --skill spring-kafka

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integrates production-grade Kafka messaging into Java 21 / Spring Boot 3.x services to ensure reliable, ordered, and auditable event delivery for financial workloads. It eliminates common pitfalls like lost messages, duplicate processing, improper offset commits, and unhandled consumer failures.

Core Features & Use Cases

  • Producer best practices: idempotent producers, acks=all, batching and compression tuned for throughput and durability.
  • Consumer resilience: manual acknowledgement, idempotent consumers via deduplication table, MDC correlation propagation, and controlled concurrency.
  • Error handling & DLT: exponential backoff retries, DefaultErrorHandler with DeadLetterPublishingRecoverer routing to topic.DLT, and non-retryable deserialization handling.
  • Operational patterns: topic naming conventions, TopicBuilder/NewTopic configuration, transactional outbox pattern for atomic DB+event writes, and guidance for schema evolution.
  • Use Case: publish TransactionCreatedEvent from the transaction service, guarantee at-least-once delivery via outbox, and ensure ledger-service consumes idempotently with failures routed to a DLT.

Quick Start

Publish a TransactionCreatedEvent to prod.banking.transaction.created with an idempotent producer and configure a consumer with manual acknowledgment and DLT routing to validate end-to-end reliability.

Frequently Asked Questions about spring-kafka

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure an idempotent Kafka producer in Spring Boot?

To configure an idempotent Kafka producer in Spring Boot, you enable producer idempotence with acks=all alongside batching and compression. This ensures reliable event delivery by preventing duplicate messages during network retries.

How do I handle consumer failures and route messages to a Dead Letter Topic in Spring Boot?

You handle consumer failures and route messages to a Dead Letter Topic in Spring Boot using DefaultErrorHandler with DeadLetterPublishingRecoverer. This pattern routes failed events to topic.DLT after exhausting configurable retries with exponential backoff.

What is the transactional outbox pattern for Kafka event publishing?

The transactional outbox pattern for Kafka event publishing atomically combines database writes with event delivery. It guarantees at-least-once delivery by storing events in an outbox table before publishing them to Kafka from your Spring Boot service.

How do I ensure idempotent Kafka consumer processing in Java?

You ensure idempotent Kafka consumer processing in Java by using a deduplication table to track processed event IDs. This prevents duplicate processing of redelivered messages when consuming events with manual offset acknowledgment.

Does this Kafka configuration work with Java 21 and Spring Boot 3.x?

Yes, this Kafka configuration works with Java 21 and Spring Boot 3.x, specifically targeting banking platforms. It handles topic configuration, partitioning, and consumer group processing for financial workloads like TransactionCreatedEvent.

Why does my Kafka consumer process duplicate messages during retries?

Your Kafka consumer processes duplicate messages during retries because of at-least-once delivery guarantees. You can prevent this by implementing idempotent consumers via a deduplication table alongside manual offset acknowledgment.