0

im using spring reactive kafka to create a consumer but retry logic is not working when there is an exception.

@EventListener(ApplicationReadyEvnt.class)
public void consume(){
reactiveKafkaConsumerTemplate.reciveAutoAck()
.map(ConsumerRecord::value)
.flatMap(record->consumeException(record)) //this method throws an exception
.doOnError(err->log.error("Something went wrong : {} ",err))
.retrywhen(Retry.max(3).transientErrors(true)).retry()
.subscribe();

is there a way we can do something similar to @retryable as it does retry on actual topic and does retry on retryTopic and then pushes it DLT?

does reactive kafka pull the messages from all the partitions or is it creating a single consumer to poll the messages from single partition if so can we create multiple consumer threads as we do in traditional kafka by setting the concurrency ?

i tried logging the code but still couldn't figured why it was not working

kumar
  • 1
  • The default kafka consumer is single threaded and provides one message at a time (from all the partitions that are assgined to the consumer). If you are using the parallel consumer, then it can process more than one message concurrently. It might help to follow this [tutorial](https://developer.confluent.io/tutorials/confluent-parallel-consumer/kafka.html) from confluent. – Augusto Mar 01 '23 at 22:17
  • @Augusto is there a way we can set in spring reactive kafka instead of using any 3rd party library.Thank you – kumar Mar 02 '23 at 05:26

0 Answers0