-
Notifications
You must be signed in to change notification settings - Fork 15
Can we add a stream information to SubscriptionListener.SubscriptionContext? #540
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
What would be the use case? |
Like a for example, In the subscription implementation(MyStreamSubscriptionListener), it is not possible to distinguish which stream (my-stream ? or my-stream2 ?) is being controlled. myStreamSubscriptionListener = new MyStreamSubscriptionListener();
environment.consumerBuilder()
.stream("my-stream")
.subscriptionListener(myStreamSubscriptionListener)
environment.consumerBuilder()
.stream("my-stream2")
.subscriptionListener(myStreamSubscriptionListener) if there are more information in class MySubscriptionListener : SubscriptionListener {
private val externalOffsetSource = mapOf<String, Long>()
override fun preSubscribe(subscriptionContext: SubscriptionListener.SubscriptionContext) {
val externalOffset = externalOffsetSource[subscriptionContext.stream()]!!
subscriptionContext.offsetSpecification(OffsetSpecification.offset(externalOffset))
}
} And i have multiple stream consumer in single application. but i can't distinguish which stream offset is for from below log (ConsumersCoordinator.add). only printed offset in the log
Yes. i can attach lambda subscriptionListener on each consumerBuilder() to distinguish stream. But like a |
I added the stream name to the context, you can try with snapshots. |
Is your feature request related to a problem? Please describe.
It will be nice if
SubscriptionListener
have stream information(stream name, consumer name... etc) in addition to offsetDescribe the solution you'd like
Add a information to
SubscriptionListener.SubscriptionContext
and it must be readonlyDescribe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: