Manages notifications for tracing pubsub activity. When pubsub takes a certain action such as sending a message or creating a topic, and the notification flag for that activity is True, all registered notification handlers get corresponding method called with information about the activity, such as which listener subscribed to which topic. See INotificationHandler for which method gets called for each activity.
If more than one notification handler has been registered, the order in which they are notified is unspecified (do not rely on it).
Note that this manager automatically unregisters all handlers when the Python interpreter exits, to help avoid NoneType exceptions during shutdown. This “shutdown” starts when the last line of app “main” has executed; the Python interpreter then starts cleaning up, garbage collecting everything, which could lead to various pubsub notifications – by then they should be of no interest – such as dead listeners, etc.
__init__ |
|
addHandler |
|
clearHandlers |
|
getFlagStates |
Return state of each notification flag, as a dict. |
getHandlers |
|
notifyDeadListener |
|
notifyDelTopic |
|
notifyNewTopic |
|
notifySend |
|
notifySubscribe |
|
notifyUnsubscribe |
|
setFlagStates |
Set the notification flag on/off for various aspects of pubsub. |
NotificationMgr
¶Manages notifications for tracing pubsub activity. When pubsub takes a certain action such as sending a message or creating a topic, and the notification flag for that activity is True, all registered notification handlers get corresponding method called with information about the activity, such as which listener subscribed to which topic. See INotificationHandler for which method gets called for each activity.
If more than one notification handler has been registered, the order in which they are notified is unspecified (do not rely on it).
Note that this manager automatically unregisters all handlers when the Python interpreter exits, to help avoid NoneType exceptions during shutdown. This “shutdown” starts when the last line of app “main” has executed; the Python interpreter then starts cleaning up, garbage collecting everything, which could lead to various pubsub notifications – by then they should be of no interest – such as dead listeners, etc.
__init__
(self, notificationHandler = None)¶addHandler
(self, handler)¶clearHandlers
(self)¶getFlagStates
(self)¶Return state of each notification flag, as a dict.
getHandlers
(self)¶notifyDeadListener
(self, *args, **kwargs)¶notifyDelTopic
(self, *args, **kwargs)¶notifyNewTopic
(self, *args, **kwargs)¶notifySend
(self, *args, **kwargs)¶notifySubscribe
(self, *args, **kwargs)¶notifyUnsubscribe
(self, *args, **kwargs)¶setFlagStates
(self, subscribe=None, unsubscribe=None, deadListener=None, sendMessage=None, newTopic=None, delTopic=None, all=None)¶Set the notification flag on/off for various aspects of pubsub. The kwargs that are None are left at their current value. The ‘all’, if not None, is set first. E.g.
mgr.setFlagStates(all=True, delTopic=False)
will toggle all notifications on, but will turn off the ‘delTopic’ notification.