PubSubClientFactory class¶
fastpubsub._internal.clients.PubSubClientFactory
¶
Caches the admin clients and the publishers of each event loop.
The cache keeps the creation task of each client, so concurrent first calls for the same key wait for the same task and get the same client.
The class needs no lock on free-threaded Python. Each key holds an
event loop, so only the thread of that loop creates or reads the
entry, and each single dict operation is atomic.
get_admin_client
async
classmethod
¶
Gets or creates the admin client of the running event loop.
| RETURNS | DESCRIPTION |
|---|---|
AdminClient
|
The admin client. |
Source code in fastpubsub/_internal/clients.py
get_publisher
async
classmethod
¶
Gets or creates the publisher of a topic for the running loop.
| PARAMETER | DESCRIPTION |
|---|---|
topic_path
|
The full path of the topic.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Publisher
|
The publisher of the topic. |
Source code in fastpubsub/_internal/clients.py
close_all
async
classmethod
¶
Sends the pending messages and clears the cache.