A more robust replacement for the signal operations.
A coroutine subscribes itself to a PublishSubscribeQueue and get new
published messages with _fetch_ method.
-
compact()
- Compacts the queue: removes all the messages from the queue that
have been fetched by all the subscribed coroutines.
Returns the number of messages that have been removed.
-
fetch(key=None, **kws)
- Get all the new messages since the last fetch. Returns a list
of messages. works as a coroutine operation
-
publish(message, key=None, **kws)
- Put a message in the queue and updates any coroutine wating with
fetch. works as a coroutine operation
-
subscribe(key=None, **kws)
- Registers the calling coroutine to the queue. Sets the update index
to 0 - on fetch, that coroutine will get all the messages from the
queue. works as a coroutine operation
-
unsubscribe(key=None, **kws)
- Unregisters the calling coroutine to the queue.