spade_pubsub package¶
Submodules¶
spade_pubsub.pubsub module¶
- class spade_pubsub.pubsub.Payload(*args, **kwargs)[source]¶
Bases:
aioxmpp.xso.model.XSO
- ATTR_MAP = {}¶
- CHILD_MAP = {}¶
- CHILD_PROPS = OrderedSet([])¶
- COLLECTOR_PROPERTY = None¶
- DECLARE_NS = {None: 'spade.pubsub'}¶
- TAG = ('spade.pubsub', 'payload')¶
- TEXT_PROPERTY¶
- data¶
- class spade_pubsub.pubsub.PubSubMixin[source]¶
Bases:
object
This mixin provides PubSub support to SPADE agents. It must be used as superclass of a spade.Agent subclass.
- class PubSubComponent(client)[source]¶
Bases:
object
- async create(target_jid: str, target_node: Optional[str] = None)[source]¶
Create a new node at a service.
- Args:
target_jid (str): Address of the PubSub service. target_node (str or None): Name of the PubSub node to create
- async delete(target_jid: str, target_node: Optional[str], redirect_uri: Optional[str] = None)[source]¶
Delete an existing node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str or None): Name of the PubSub node to delete. redirect_uri (str or None): A URI to send to subscribers to indicate a replacement for the deleted node.
- async get_items(target_jid: str, target_node: Optional[str])[source]¶
Request all items at a service or collection node.
- Args:
target_jid (str): Addressof the PubSub service. target_node (str): Name of the PubSub node.
- async get_node_subscriptions(target_jid: str, target_node: Optional[str]) → List[str][source]¶
Return the subscriptions of other jids with a node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the node to query
- async get_nodes(target_jid: str, target_node: Optional[str] = None)[source]¶
Request all nodes at a service or collection node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str or None): Name of the collection node to query
- async notify(target_jid: str, target_node: str)[source]¶
Notify all subscribers of a node without publishing an item. “Publish” to the node at jid without any item. This merely fans out a notification.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the PubSub node to send a notify from.
- async publish(target_jid: str, target_node: str, payload: str, item_id: Optional[str] = None)[source]¶
Publish an item to a node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the PubSub node to publish to. payload (str): Payload to publish. item_id (str or None): Item ID to use for the item.
- async purge(target_jid: str, target_node: Optional[str])[source]¶
Delete all items from a node.
- Args:
target_jid (str): JID of the PubSub service target_node (str): Name of the PubSub node
- async retract(target_jid: str, target_node: str, item_id: str, notify=False)[source]¶
Retract a previously published item from a node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the PubSub node to send a notify from. item_id (str): The ID of the item to retract. notify (bool): Flag indicating whether subscribers shall be notified about the retraction.
- async subscribe(target_jid: str, target_node: Optional[str] = None, subscription_jid: Optional[str] = None, config=None)[source]¶
Subscribe to a node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the PubSub node to subscribe to. subscription_jid (str): The address to subscribe to the service. config (Data): Optional configuration of the subscription
- async unsubscribe(target_jid: str, target_node: Optional[str] = None, subscription_jid: Optional[str] = None, subid=None)[source]¶
Unsubscribe from a node.
- Args:
target_jid (str): Address of the PubSub service. target_node (str): Name of the PubSub node to unsubscribe from. subscription_jid (str): The address to subscribe from the service. subid (str): Unique ID of the subscription to remove.
Module contents¶
Top-level package for SPADE PubSub.