Spring for Apache Kafka

The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of Kafka-based messaging solutions. It provides a "template" as a high-level abstraction for sending messages. It also provides support for Message-driven POJOs with @KafkaListener annotations and a "listener container". These libraries promote the use of dependency injection and declarative. In all of these cases, you will see similarities to the JMS support in the Spring Framework and RabbitMQ support in Spring AMQP.

Quick Start
Fork me on GitHub


  • KafkaTemplate
  • KafkaMessageListenerContainer
  • @KafkaListener
  • KafkaTransactionManager
  • spring-kafka-test jar with embedded kafka server

Quick Start


The recommended way to get started using spring-kafka in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

Kafka Client Compatibility

Spring for Apache Kafka is based on the pure java kafka-clients jar. The following is the compatibility matrix:

Spring for Apache Kafka Version Spring Integration for Apache Kafka Version kafka-clients Version
2.1.x 3.0.x 1.0.x
2.0.x 3.0.x 0.11.0.x, 1.0.x
1.3.x 2.3.x 0.11.0.x, 1.0.x
1.2.x 2.2.x 0.10.2.x
1.1.x 2.1.x 0.10.0.x, 0.10.1.x
1.0.x 2.0.x 0.9.x.x
N/A* 1.3.x
  • Spring Integration Kafka versions prior to 2.0 pre-dated the Spring for Apache Kafka project and therefore were not based on it.

These versions will be referenced transitively when using maven or gradle for version management. For the 1.1.x version, the 0.10.1.x is the default.

Sample Projects

Getting Started Guides