Method: Mongo::Monitoring::Subscribable#unsubscribe
- Defined in:
- lib/mongo/monitoring.rb
#unsubscribe(topic, subscriber) ⇒ Object
Global subscriber registry is separate from per-client subscriber registry. The same subscriber can be subscribed to events from a particular client as well as globally; unsubscribing globally will not unsubscribe that subscriber from the client it was explicitly subscribed to.
Currently the list of global subscribers is copied into a client whenever the client is created. Thus unsubscribing a subscriber globally has no effect for existing clients - they will continue sending events to the unsubscribed subscriber.
Unsubscribe a listener from an event topic.
If the listener was subscribed to the event topic multiple times, this call removes a single subscription.
If the listener was not subscribed to the topic, this operation is a no-op and no exceptions are raised.
138 139 140 141 142 143 144 |
# File 'lib/mongo/monitoring.rb', line 138 def unsubscribe(topic, subscriber) subs = subscribers_for(topic) index = subs.index(subscriber) if index subs.delete_at(index) end end |