Client SDKsPythonReference
Client
Client classes and configuration — KubeMQ Python SDK reference.
The Python SDK ships pattern-specific async clients. AsyncPubSubClient handles Events and Events Store, AsyncQueuesClient handles Queues, and AsyncCQClient handles Commands and Queries. All accept the same constructor options and work as async context managers.
Package
pip install kubemqRequires Python 3.9+.
Client classes
| Client | Import | Notes |
|---|---|---|
AsyncPubSubClient | from kubemq import AsyncPubSubClient | Events + Events Store |
AsyncQueuesClient | from kubemq import AsyncQueuesClient | Queues |
AsyncCQClient | from kubemq import AsyncCQClient | Commands + Queries |
Constructor (illustrative)
AsyncPubSubClient(
address: str = "localhost:50000",
client_id: str | None = None,
auth_token: str | None = None,
...
)Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
address | str | Yes | Broker endpoint (host:port) |
client_id | str | No | Auto-generated when omitted |
auth_token | str | No | Bearer token |
| TLS / cert kwargs | various | No | Mutual TLS configuration |
Returns: Client instance (connect via async with or await client.connect()).
Throws: KubeMQError subclasses — connection, validation, or auth failures.
Note: Pass
AsyncCancellationTokenobjects into long-running subscriptions to stop workers cooperatively.
Context managers
async with AsyncPubSubClient(address="localhost:50000") as client:
...Quick Usage
import asyncio
from kubemq import AsyncPubSubClient
async def main():
async with AsyncPubSubClient(address="localhost:50000", client_id="py-demo") as client:
await client.ping()
asyncio.run(main())See Also
Was this page helpful?