Project Reactor - Long running Reactive Kafka Consumer

744 views Asked by At

Does any one have an example for a Long running Reactive Kafka Consumer ? The SampleConsumer in https://github.com/reactor/reactor-kafka.git quits after subscription which is expected.But I have a requirement to continuously receive messages from our Topics, and to which I should reconnect in the event of failures(especially connectivity issues).

I did go through https://github.com/CollaborationInEncapsulation/s1p-reactor-netty-kafka-twitter.git as a help to come up with an example but was not very successful.Help appreciated

1

There are 1 answers

0
schengalath On

It was an easy fix to convert SampleConsumer to a LongRunningSampleConsumer.The change was to add a blockLast to block indefinitely.I know that blocking is not the most optimal way to achieve what I am aiming to do and I'm open to alternate solutions.

The current code is in my git below.

https://github.com/schengalath/reactor-kafka/blob/master/reactor-kafka-samples/src/main/java/reactor/kafka/samples/LongRunningSampleConsumer.java