Spring for Apache Kafka Milestone 1 Available

DZone 's Guide to

Spring for Apache Kafka Milestone 1 Available

Spring for Apache Kafka milestone one is now available! Here's a list of what it provides, including a message listener container, annotations for POJO message listeners, and a Kafka template for async and sync Kafka topics.

· Integration Zone ·
Free Resource

I am pleased to announce that the spring-kafka (Spring for Apache Kafka) first milestone is now available (1.0.0.M1).

The existing spring-integration-kafka extension project - currently at version 1.3.0.RELEASE supports Kafka 0.8.x.x and is used in Spring XD (Kafka MessageBus) and Spring Cloud Stream (Kafka Binder).

This new project (spring-kafka) breaks out the core components into a separate project. It is based on the new 0.9.0.x pure Java Kafka clients.

spring-kafka brings the familiar Spring programming model to Apache Kafka for any Spring user, not just those using Spring Integration. An upcoming spring-integration-kafka release will be a complete rewrite, utilizing the spring-kafka project internally.

Much like the other messaging projects in the Spring portfolio, spring-kafka provides:

  • Message Listener Container.
  • Annotations for POJO message listeners (@KafkaListener - similar to @JmsListener and @RabbitListener).
  • KafkaTemplate for sync and async sending to Kafka topics:
public class KafkaConfig {
     // Infrastructure @Beans omitted. 
     // See Reference Manual and tests for comprehensive sample

     public Listener listener() {
        return new Listener();


public class Listener {

     @KafkaListener(topics = "myTopic")
     public void handleFromKakfa(String payload) {


Using maven or Gradle:

dependencies {
    compile 'org.springframework.kafka:spring-kafka:1.0.0.M1'

In addition, the spring-kafka-test artifact is available, containing support for testing, including an embedded Kafka broker, hamcrest Matchers etc.

Both artifacts are available in the repo.spring.io/milestone repository.

See the milestone 1 reference manual for more information.

Many thanks to Soby Chacko (for kicking off the initial Spring Integration Kafka extension), Marius Bogoevici and Artem Bilan for their help with this important project.

  • First milestone of spring-integration-kafka (2.0) based on spring-kafka
  • A Spring Boot starter, with auto configuration support etc.
  • A new Binder implementation for spring-cloud-stream
  • Flesh out the documentation, set up a project page etc.

In the meantime, you can follow progress, report issues, etc, in the GitHub repo.

Original article by Gary Russell

integration, java, kafka, spring

Published at DZone with permission of Gary Russell , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}