3

I started looking into using a DeadLetterPublishingRecoverer for my kafka consumer factory common error handler. However, it seems that in order to instantiate an instance of this class, 1 option is to pass in a KafkaOperations<? extends Object, ? extends object> template. From previous examples, most seem to simply pass in a KafkaTemplate<>. However, I am using the reactive version of kafka for both the consumer & producer templates. So, I am not sure if it is somehow possible to use the ReactiveKafkaConsumerTemplate<> for this use case?

public ConcurrentKafkaListenerContainerFactory<String, Object> kafkaListenerFactory() {
    ConcurrentKafkaListenerContainerFactory<String, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
    factory.setCommonErrorHandler(new DefaultErrorHandler(new DeadLetterPublishingRecoverer( **HERE** ), ...));
    ...
}
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
jimbob542
  • 121
  • 1
  • 1
  • 7

1 Answers1

1

The DLPR is not designed for use with the reactive template.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Any plans to support reactive templates in the future? Or will I need to write my own ? – jimbob542 Sep 19 '22 at 18:22
  • 2
    The reactive template is a very lightweight wrapper around reactor-kafka. We have no plans for any further enhancement. There's an example of using the DLRP in a non-reactive way from reactor in this issue https://github.com/reactor/reactor-kafka/issues/214#issuecomment-821760338 For the most part, kafka sends are non-blocking (except when fetching metadata). – Gary Russell Sep 19 '22 at 20:22