Skip to content

roar-skinderviken/spring-kafka-retryable-transactional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-kafka-retryable-transactional

A Spring Kafka application demonstrating how to migrate from the @RetryableTopic annotation to a transactional retry mechanism.

Overview

The starting point is the RetryableTopicFooListener which is not using transactions. Tests for this class are implemented in RetryableTopicFooListenerIntegrationTest.

The transactional version is implemented in TransactionalFooListener and is activated by profile = "tx". Tests for this class are implemented in TransactionalFooListenerContainerTest.

TransactionalFooListenerContainerTest and TransactionalFooListenerSpringJUnitTest show the same transaction tests using ConfluentKafkaContainer and @SpringJUnitConfig respectively.

The ConcurrentKafkaListenerContainerFactory is configured with a DefaultAfterRollbackProcessor in ListenerContainerFactoryConfig

An alternative approach using BeanPostProcessor is in ListenerContainerFactoryBeanPostProcessor.

@SpringBoot- and @SpringJUnitConfig tests are sharing the same tests defined in ListenerTestBase

Prerequisites

Java 21+ Docker (for running test container tests)

Running Test

./gradlew clean check --info

About

A Spring Kafka application demonstrating how to migrate from the @RetryableTopic annotation to a transactional retry mechanism.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages