Open Malandril opened 1 month ago
Thanks for reporting this. You've touched an important point on how to use the Kafka request-reply feature. For context, that wait is there to make sure that the reply consumer is actually listening for replies. Currently, it waits on subscription (wiring time), with the goal of preserving the order of sent requests.
We can introduce another timeout option and even maybe another flag to whether wait or not on partition assignment.
Your feedback would be appreciated.
I think a different timeout property would make sense for the initial subscription, and a way to disable it.
But would it fix the issue ?
If the subscription occurs later wouldn't the KafkaRequestReply
still enter in an unrecoverable Illegal state in case of an unavailability of the Kafka broker ?
The current behavior is described in here. The waiting only makes sense if you've auto.offset.reset=latest
.
I think at least having an option to disable the wait makes sense. The subscription occurs on wiring time (runtime startup) because the subscriber for that emitter is the outgoing Kafka channel.
Context
When using quarkus 3.13.0 with a
KafkaRequestReply
at startup if theKafkaRequestReply
'swaitForAssignments
takes longer than the reply topic timeout, theKafkaRequestReply
will always throwIt might be caused when we get the publisher here https://github.com/smallrye/smallrye-reactive-messaging/blob/8427a52664c023341f24dd2a19ab7f1ca90a6f6d/smallrye-reactive-messaging-kafka/src/main/java/io/smallrye/reactive/messaging/kafka/reply/KafkaRequestReplyImpl.java#L155
Reproducing the bug
Clone https://github.com/Malandril/quarkus-kafka-bug
Run the application dev mode
After 5 seconds (the default reply timeout) start the kafka broker with
docker compose up -d
.When you query the endpoint
/question
curl -v localhost:8080/question
it fails.When you query the endpoint
/question-2
curl -v localhost:8080/question-2
it works as expected.When you query the endpoint
/answers
curl -v localhost:8080/answers
it works as expected.Expected behaviour
The
KafkaRequestReply
should be able to recover from kafka connection failure on startup. And should work after the kafka connection has been restored. It should be the same behaviour as a classicEmitter
.