Spring for Apache Kafka

Authors

Gary Russell , Artem Bilan , Biju Kunjummen

2.1.13.RELEASE

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


Table of Contents

1. Preface
2. What’s new?
2.1. What’s new in 2.1 Since 2.0
2.1.1. Kafka Client Version
2.1.2. JSON Improvements
2.1.3. Container Stopping Error Handlers
2.1.4. Pausing/Resuming Containers
2.1.5. Stateful Retry
2.1.6. Client ID
2.1.7. Logging Offset Commits
2.1.8. Default @KafkaHandler
2.1.9. ReplyingKafkaTemplate
2.1.10. ChainedKafkaTransactionManager
2.1.11. After rollback processing
2.1.12. Transactional Id
2.1.13. Migration Guide from 2.0
3. Introduction
3.1. Quick Tour for the Impatient
3.1.1. Introduction
Compatibility
Very, Very Quick
With Java Configuration
Even Quicker, with Spring Boot
4. Reference
4.1. Using Spring for Apache Kafka
4.1.1. Configuring Topics
4.1.2. Sending Messages
KafkaTemplate
Transactions
ReplyingKafkaTemplate
4.1.3. Receiving Messages
Message Listeners
Message Listener Containers
@KafkaListener Annotation
Container Thread Naming
@KafkaListener on a Class
@KafkaListener Lifecycle Management
Rebalance Listeners
Forwarding Listener Results using @SendTo
Filtering Messages
Retrying Deliveries
Stateful Retry
Detecting Idle and Non-Responsive Consumers
Topic/Partition Initial Offset
Seeking to a Specific Offset
4.1.4. Pausing/Resuming Listener Containers
4.1.5. Serialization/Deserialization and Message Conversion
Overview
Payload Conversion with Batch Listeners
ConversionService Customization
4.1.6. Message Headers
4.1.7. Null Payloads and Log Compaction Tombstone Records
4.1.8. Handling Exceptions
Listener Error Handlers
Container Error Handlers
Consumer-Aware Container Error Handlers
Seek To Current Container Error Handlers
Container Stopping Error Handlers
After Rollback Processor
4.1.9. Kerberos
4.2. Kafka Streams Support
4.2.1. Introduction
4.2.2. Basics
4.2.3. Spring Management
4.2.4. JSON Serdes
4.2.5. Configuration
4.2.6. Kafka Streams Example
4.3. Testing Applications
4.3.1. Introduction
4.3.2. JUnit
4.3.3. Using the Same Broker(s) for Multiple Test Classes
4.3.4. @EmbeddedKafka Annotation
4.3.5. Hamcrest Matchers
4.3.6. AssertJ Conditions
4.3.7. Example
5. Spring Integration
5.1. Spring Integration for Apache Kafka
5.1.1. Introduction
5.1.2. Outbound Channel Adapter
5.1.3. Message Driven Channel Adapter
5.1.4. Outbound Gateway
5.1.5. Inbound Gateway
5.1.6. Message Conversion
5.1.7. What’s New in Spring Integration for Apache Kafka
2.1.x
2.2.x
2.3.x
3.0.x
6. Other Resources
A. Override Dependencies to use the 1.1.x/2.0.x kafka-clients with an Embedded Broker
B. Change History
B.1. Changes Between 1.3 and 2.0
B.1.1. Spring Framework and Java Versions
B.1.2. @KafkaListener Changes
B.1.3. Message Listeners
B.1.4. ConsumerAwareRebalanceListener
B.2. Changes Between 1.2 and 1.3
B.2.1. Support for Transactions
B.2.2. Support for Headers
B.2.3. Creating Topics
B.2.4. Support for Kafka timestamps
B.2.5. @KafkaListener Changes
B.2.6. @EmbeddedKafka Annotation
B.2.7. Kerberos Configuration
B.3. Changes between 1.1 and 1.2
B.4. Changes between 1.0 and 1.1
B.4.1. Kafka Client
B.4.2. Batch Listeners
B.4.3. Null Payloads
B.4.4. Initial Offset
B.4.5. Seek