Class: cogen.core.pubsub.PublishSubscribeQueue
A more robust replacement for the signal operations. A coroutine subscribes itself to a PublishSubscribeQueue and get new published messages with _fetch_ method.
Constructor
__init__ (self)
Methods
compact (self)
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 (self, **kws)
Get all the new messages since the last fetch. Returns a list of messages. works as a coroutine operation
publish (self, message, **kws)
Put a message in the queue and updates any coroutine wating with fetch. works as a coroutine operation
subscribe (self, **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