-
Notifications
You must be signed in to change notification settings - Fork 32
Subscription/Notification : adding a maxEventLimit attribute #90
Description
Problem description
As of today the only way to limit a subscriptions is to provide a subcriptionExpiryTime and we are not allowing to subscribe to a number of notification. If I need to be notified once that a device entered or existed a zone what is the point to get the subscription valid, when notified, because the subcriptionExpiryTime is not reached ? (like for sim card that are embedded in equipment that are not suppose to move like in traffic light...).
Request driven from
Possible evolution
Add a new attribute in the subscription like maxEventLimit (or other better name).
We can position is like this:
If we want to keep the subscription going irrespective of notification count, we can just input the subcriptionExpiryTime. An infinite/unlimited number of notifications can be sent as long as the expiry time is not reached and the event keeps happening.
If we both define a subcriptionExpiryTime and a maxEventLimit, subscription ends whichever condition is satisfied first.
Similarly, we can create a subscription without a subcriptionExpiryTime, only with a maxEventLimit. Then, subscription does not expire based on time but terminates if entry/exit event happens n times.
Lastly, it is possible to define neither of those conditions and the subscription goes forever with any number of notifications, unless the user explicitly unsubscribes.
(Thanks to https://github.com/alpaycetin74 proposal)
A new terminationReason could be added: MAX_EVENTS_REACHED
cc: @jlurien
Alternative solution
Additional context