Fix deleting durable subscriptions on unsubscribe#13
Fix deleting durable subscriptions on unsubscribe#13afansv wants to merge 4 commits intoThreeDotsLabs:mainfrom
Conversation
|
Thanks for this. Need to dig around in the docs next week and confirm it's still desirable (linked page is for STAN) but I think it makes sense. |
|
Do you have an example use case in mind for including the topic in durable name / queue group calculations @afansv ? |
No. it's actually pretty pointless. |
|
I could imagine a scheme where either maps to some portion of the topic to be honest @afansv just a little merge-shy without some example usage. |
|
I've been working on a unified watermill-nats that can connect in jetstream or nats-core mode, the jetstream example from there could probably be modified to perform durable provisioning needed and demonstrate alternate durable / queue group calculators https://github.com/AlexCuse/watermill-nats/blob/master/_examples/jetstream.go The calculated durable name likely needs to be taken into account when deciding whether or not to unsubscribe as well (since it could be derived from the topic only by an alternate calculator). I can probably branch off yours and run with it if you don't have time @afansv , I see there are some conflicts to deal with as well. |
|
Not found any mention of unsubscribe usage relative to durable consumers in jetstream docs but did find this note in the nats client godoc that seems to suggest that only durables that are automatically created by the client would be deleted on unsubscribe, which may be desirable. https://github.com/nats-io/nats.go/blob/main/nats.go#L4286-L4295 |
|
I didn't have as much time as I'd like this week to test but I think I've seen enough that I do think we likely need this change. Given how much surface area the jetstream configuration has it might make sense to remove to auto provision option and instead provide a way users can modify the SubscribeInitialize behavior more directly. Will see what I can do to polish this PR up over the next week if you aren't able. The main things I see as needed are deleting the comment that links to legacy nats-streaming-server docs and taking the calculated durable into account when deciding whether or not to unsubscribe. |
From here: https://docs.nats.io/nats-concepts/jetstream/consumers This actually seems to suggest unsubscribing would be fine. What is the durable setup you are using that you've seen problems with on close/unsubscribe? |
When the application wants to stop receiving messages on a durable subscription, it should close - but not unsubscribe - this subscription.
https://docs.nats.io/legacy/stan/intro/channels/subscriptions/durable