Spring For Apache Kafka 2.0 Milestone 1 Available

Releases | Gary Russell | April 27, 2017 | ...

We are very pleased to announce the availability of the first milestone of the Spring for Apache Kafka 2.0 release 2.0.0.M1.

Significant new features in the 2.0 line include:

  • Support for timestamps in the KafkaTemplate.

  • Seek to beginning/end of topics.

  • New threading model facilitated by KIP-62 - now that the consumer client does not rely on poll() being called frequently, the threading model is much simpler; avoiding the need for internal pause() / resume() processing. Listeners are now always invoked on the consumer thread. This, in turn, has facilitated:

  • ConsumerAwareMessageListener (and BatchConsumerAwareMessageListener) are provided so that listener implementations can access the Consumer<?, ?> object to perform operations such as pause(), resume(), metrics() etc.

  • @KafkaListener POJO methods can now be annotated with @SendTo to send the method result to some other topic.

    @KafkaListener(id = "replyingListener", topics = "inTopic") @SendTo("replyTopic") public String replyingListener(String in) { return in.toUpperCase(); }

For more information, see Forwarding Listener Results using @SendTo.

  • @KafkaListener annotations now have an errorHandler property, allowing a custom error handler to be configured for each. Previously, you had to use a different container factory for each.

  • The embedded kafka server JUnit @Rule in spring-kafka-test can now be provided as a Spring Bean instead (and auto wired into your tests). For further simplification, the framework can auto-declare the bean for you; simply add @EmbeddedKafka to your test class. See @EmbeddedKafka Annotation for more information.

In addition, the first 3.0 milestone of the Spring Integration Kafka extension is available (3.0.0.M1) based on this spring-kafka milestone.

The milestone releases for both projects are available in the Spring milestone repository.

We very much appreciate the feedback (and contributions) received to-date.


Unfortunately, the spring-kafka pom has an incorrect transitive dependency on spring-messaging-5.0.0.BUILD-SNAPSHOT. We don’t recommend using milestones in production, but in order to provide a stable platform for testing, you should override this dependency to 5.0.0.M5.

General availability of the 2.0 release is expected to be in the early summer (shortly after the Spring Framework 5.0 release). Feedback, feature requests and, of course, contributions are welcomed via the usual channels:

Project Page | Issues | Contributing | Help | Chat

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all