Expose KafkaConsumer in ReceiverOptionsCustomizer.addAssignListener() - parity with KafkaBindingRebalanceListener #379
Labels
❓need-triage
This issue needs triage, hasn't been looked at by a team member yet
To be able to access the KafkaConsumer when using
receiverOptions.addAssignListener
:Motivation
In spring-cloud-stream/issues/2727
a similar feature was requested to access the endOffsets. This was then implemented in reactor-kafka/issues/344 by @garyrussell .
In my case, instead of needing the endOffsets, I need to check which partitions have commits. The usecase is to only
seekToTimestamp
for partitions that have no commits.Maybe we should expose the consumer instance as originally suggested like in KafkaBindingRebalanceListener, to avoid ending up with a facade for all possible custom needs.
Desired solution
A consumer instance is received in an overload of addAssignListener.
Additional context
spring-cloud/spring-cloud-stream#2727
#344
https://docs.spring.io/spring-cloud-stream/reference/kafka/kafka-binder/rebalance_listener.html
Workarround
Right now, I am forced to go with a very bad workaround suing the consumerListener which is cleary not good enough for production.
Another alternative would be to add a
seekToTimestampIfNoCommits
or a flagskipIfHasCommits
. However, if we start adding so many options, we are basically replicating the full consumer.The text was updated successfully, but these errors were encountered: