Common: Add comment about subscribing to all topics in PyPubSubEventQueue

This commit is contained in:
Shreya Malviya 2022-08-10 14:49:31 +05:30
parent f26beb6464
commit 2fd66bc9e2
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,12 @@ class PyPubSubEventQueue(IEventQueue):
self._pypubsub_publisher = pypubsub_publisher
def subscribe_all(self, subscriber: Callable[[AbstractEvent], None]):
# From the documentation (https://pypubsub.readthedocs.io/en/v4.0.3/usage/
# usage_advanced_debug.html#listen-for-messages-from-all-topics):
# "PyPubSub defines a special topic named pub.ALL_TOPICS. A listener that subscribes
# to this topic will receives all messages of every topic. By default, the listener
# will not receive any data since pub.ALL_TOPICS is the parent of all root topics (...)"
self._pypubsub_publisher.subscribe(
listener=subscriber, topicName=self._pypubsub_publisher.ALL_TOPICS
)