Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Multiple Topic Config in on Producer Spring Reactive Kafka

I am new to Kafka and We are using Spring Web Flux in the application. We have a requirement to push two different messages to two different Topics say T1 and T2. Kafka Broker is the same. We are using ReactiveKafkaProducerTemplate and it working fine.

    @Bean
    public ReactiveKafkaProducerTemplate<String, Object> reactiveKafkaProducerTemplate(
            KafkaProperties properties) {
        final Map<String, Object> props = properties.buildProducerProperties();
        return new ReactiveKafkaProducerTemplate<String, Object>(SenderOptions.create(props));
    }

Now we have requirement to compress only one Topic[T1] content alone as the message size is more on the Topic T1. Do we have something like RoutingKafkaTemplate support in Reactive Kafka or Project Reactor where we can modify the Producer Config as per Topic needs?

like image 361
vinilpj Avatar asked Nov 17 '25 05:11

vinilpj


1 Answers

No; there is no equivalent; you need to configure two templates with different producer configs.

like image 151
Gary Russell Avatar answered Nov 20 '25 05:11

Gary Russell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!