You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So both are called on active subscription.
Both are also counting number of messages since the start of the subscription, and when max is already reched when setting UNSUB, it will immediately close the subscription.
If not, it will check the max internally at every message, and close subscription when counter reaches max.
For re-subscribing, you can still maintain the subscription state on the client side, and just resubscribe with the server.
Currently we don't have an explicit unsubscribe method, it's done during subscription dispose. More natural way might be to add maxMsgs field to subscription options in our case.
mtmk
changed the title
UNSUB max_msgs support
Auto-unsubscribe options
Jun 28, 2023
mtmk
linked a pull request
Jun 30, 2023
that will
close
this issue
Users should be able to automatically unsubscribe:
Dispose
)First scenario (max-msgs) can be implemented using UNSUB
max_msgs
:SUB
then immediatelyUNSUB
withmax_msgs
specifiedcount
for subscriptioncount == max_msgs
signal user code (e.g. end iterators) and remove subscriptionUNSUB
withmax_msgs - count
Timeouts would complete iterators and unsubscribe.
If combination of the options is used then whichever happens first wins and cancel others.
Unsubscribe()
method onNatsSub
MaxMsgs
onSubOpts
Timeout
onSubOpts
IdleTimeout
onSubOpts
The text was updated successfully, but these errors were encountered: