Spring Boot
note
This page covers the changes you need to make to support Responsive with Spring Boot. Note that Spring Boot integration currently requires:
- An application running JDK 17
- Version
3.2.4
ofspring-kafka
- Version
>= 0.29
ofdev.responsive.kafka-client
We are working with the spring-kafka
maintainer team to lift these requirements.
If your team requires a different configuration, please reach out to us at
info@responsive.dev.
Usage
Dependencies
In order to use Responsive with spring-kafka
, you must include the following
dependency:
- Maven
- Gradle
<dependency>
<groupId>dev.responsive</groupId>
<artifactId>responsive-spring</artifactId>
<version>RESPONSIVE_CLIENT_VERSION</version>
</dependency>
implementation 'dev.responsive:kafka-client:RESPONSIVE_CLIENT_VERSION'
Auto-Wiring
If you use auto-wiring support for spring, replace the @EnableKafkaStreams
annotation with
@EnableResponsive
:
+ import dev.responsive.spring.annotations.EnableResponsive;
@Configuration
@EnableKafka
+ @EnableResponsive
- @EnableKafkaStreams
public class MyKafkaStreamsConfiguration {
@Bean
public KStream<String, String> stream(StreamsBuilder streamsBuiler) {
// this code remains the same
...
}
}
Manual Configuration
If you manually wire the configuration using the StreamsBuilderFactoryBean
class, you
must replace all usages with dev.responsive.spring.config.ResponsiveFactoryBean
. For example:
- import org.springframework.kafka.config.StreamsBuilderFactoryBean;
+ import dev.responsive.spring.config.ResponsiveFactoryBean;
@Bean
public FactoryBean<StreamsBuilder> myKStreamBuilder(KafkaStreamsConfiguration streamsConfig) {
- return new StreamsBuilderFactoryBean(streamsConfig);
+ return new ResponsiveFactoryBean(streamsConfig);
}