Skip to main content

Using SpringBoot

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.3.0 of spring-kafka
  • Version >= 0.37 of dev.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

For a fully working end-to-end example of a ResponsiveKafkaStreams application running on spring boot, see the spring-boot responsive quickstart

Configuration

In spring-kafka 3.3.0 we introduced a method to KafkaStreamsCustomizer class that allows you to configure ResponsiveKafkaStreams when customizing your Kafka Streams application:

public class ResponsiveStreamsCustomizer implements KafkaStreamsCustomizer {

@Override
public KafkaStreams initKafkaStreams(
Topology topology,
Properties properties,
KafkaClientSupplier clientSupplier
) {
return new ResponsiveKafkaStreams(topology, properties, clientSupplier);
}

...

}

This can be wired into the StreamsBuilderFactoryBean using the #setKafkaStreamsCustomizer method on the factory bean:

  @Bean
public StreamsBuilderFactoryBeanConfigurer configure() {
return factoryBean -> {
factoryBean.setKafkaStreamsCustomizer(new ResponsiveStreamsCustomizer());
};
}

Disabling Autowiring for Cassandra

Spring will attempt to auto-wire Cassandra clients, which are configured manually by Responsive. You should make sure to disable this by adding the following to your spring boot application:

@SpringBootApplication(exclude = {CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class})