subscription¶
- class mersal.subscription.InternalHandlersActivator[source]¶
Bases:
objectDecorates a HandlerActivator with Mersal’s own control-message handlers.
Registers handlers for SubscribeRequest/UnsubscribeRequest so that any app can act as the owner (publisher) of a topic when subscription storage is decentralized.
- __init__(inner: HandlerActivator, subscription_storage: SubscriptionStorage) None[source]¶
- class mersal.subscription.SubscriptionStorage[source]¶
Bases:
ProtocolA protocol that defines the storage required to store topics subscriptions.
- __init__(*args, **kwargs)¶
- async get_subscriber_addresses(topic: str) set[str][source]¶
Get addresses subscribed for the given topic.
- Parameters:
topic¶ – topic name to get the addresses for.
- Returns:
A set of addresses subscribed to this topic.
- property is_centralized: bool¶
Whether this storage is centralized.
Centralized storage means topic subscriptions are stored in one place and registration/unregistration can be done by directly calling register_subscriber and unregister_subscriber, respectively.
Non centralized means each topic handles its own storage and registration/unregistration is performed by sending a message to the topic owner (async).