Puppy([delim])
Creates and returns a Puppy object.
delimspecifies the delimiter for parent/child topics. Must be a one-character string. If unspecified,delimdefaults to/.
Methods
-
.Pub() -
.SubPush() -
.SubPull() -
.inject(topics, data)is a testing/debugging method that injects the messagedatainto the specified topic or list of topics -
.verify()is a currently unimplemented method that will return a list of any topics which lack publishers and/or subscribers. To be used for automated verification of architectures, and possibly throwing errors when trying to publish to a topic with no subscribers or receive from a topic with no publishers
Puppy.Pub(topics)
Creates and returns a Publisher object linked to the parent Puppy instance.
topicsis a string or list of strings, specifying which topics thePublishershould publish to.
Methods
.send()
Puppy.SubPush(topics,callback[,filter])
Creates and returns a SubscriberPush object linked to the parent Puppy instance.
-
topicsis a string or list of strings, specifying which topics theSubscriberPushshould receive messages from. -
callbackis the function called with each received message -
filteris a function to filter incoming messages:-
returning
Falsewill prevent message delivery -
an error during execution will prevent message delivery
-
any return value other than
False(including falsey values) will allow message delivery -
if unspecified, the default value is equivalent to
lambda x : True
-
Methods
none
Puppy.SubPull(topics[,filter])
Creates and returns a SubscriberPull object linked to the parent Puppy instance.
-
topicsbehaves identically to thetopicsargument for SubPush -
filterbehaves identically to thefilterargument for SubPush
Methods
.recv()returns the oldest unread message, orNoneif no unread messages exist.recv_all()returns a list of all unread messages, ordered from[oldest, ... , newest], or[]if no unread messages exist