-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for NonDurable subscriptions #468
Comments
@frankjkelly The go client support reader API which is based on the non-durable subscription. Is it works for you? |
Thanks - I guess that's not what I think we're seeing using the 0.3.0 Go Client library with Pulsar 2.6.1 In the image below taken from our Pulsar Grafana dashboard hopefully you can see our Consumers (on the Here is how we have configured our consumer
|
@codelipenghui @wolfstudy wondering if I am misunderstanding something with the Go client - perhaps my |
To add some context, @frankjkelly and I spoke in the Pulsar Slack, and he mentioned that he misunderstood @codelipenghui's recommendation and that a |
I think it would be nice to have equivalence with the Java API which supports NonDurable subscriptions on both the Reader and Consumer interfaces |
Feature parity alone is not a compelling reason for me, since it duplicates functionality. Re-reading your use-case, it seems that you might even benefit more from a traditional consumer with aggressive subscription/topic removal policies. This way, at least, you know that if your consumer has a hiccough and needs to restart it won't have to start over, but that the data will still be deleted in a timely manner once the subscription is caught up. |
@flowchartsman I'm picking this up from @frankjkelly and trying to implement the Reader interface. However, I'm unsure how to implement it for our use case. Essentially, we just have a worker than wants to read a topic from the beginning to the "end" where the end is indicated by a message with an end-of-stream property. If this worker dies, the "job" will just be picked up by another worker which will start reading from the beginning of the stream. Now we need to handle reading the stream while a publisher is writing to it in real-time and we may also connect to the topic to read before the publisher does. What I'm unclear on is how to use the With the Consumer interface, we were able to simply call Thanks! |
|
excellent thanks for the explainer @flowchartsman! |
@apapia no problem. If the issue is now resolved, please feel free to close the issue, thanks! |
@flowchartsman Hi, with the reader interface, we will always have to manage the discovery of the topic partitions, and also regex consumer won't work. On top of that the backlog also won't show up in the monitoring stats. That's why imho, a NonDurable subscription is still meaningful feature. |
At my company, we use Pulsar in an enterprise application that has requirements that my team cannot control. We cannot use "aggressive subscription/topic removal policies" as there are many other requirements that control those policies. We also cannot easily use Reader model as it is very hard to scale a Reader if you want to replicate a Consumer's "shared" subscription model, scaling so that multiple consumers on the subscription will share the load of messages. We cannot just re-code in Java, we are using Golang, which is why we need the feature in Golang client. In our use case, Pulsar is processing a very large amount of data in throughput. It is important to us that if something goes wrong with our component where it is no longer able to listen/ack on its subscription, the subscription does not persist and cause a backlog of messages that could bring the enterprise level application down. Making our subscriptions non-durable seems like the perfect solution, but we can't use it because the Golang pulsar client doesn't support it. |
@frankjkelly @yangou @apapia @codelipenghui Take a look at the attached PR. It exposes the Reader's non-durable attribute to Consumer. This works well in all my tests, and my company is now using this implementation in an enterprise application. I do not know how to get the PR some attention from reviewers. |
Is your feature request related to a problem? Please describe.
The Java API supports Non-Durable Subscriptions via SubscriptionMode
https://github.com/apache/pulsar/blob/master/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerBuilder.java#L243-L256
but it appears that the Go client does not
pulsar-client-go/pulsar/consumer.go
Line 76 in 25f3075
This is useful in our use case where we have lots of topics with short-lived subscriptions that last minutes to hours and then once data is read the topic is no longer needed.
To ensure that data is compacted in the bookies currently we have to set the subscription expiration time at the namespace level
Describe the solution you'd like
Please add support for Subscription Mode
Describe alternatives you've considered
Continue to use subscription expiration time
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: