KubeMQ
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 kubemq

Requires Python 3.9+.

Client classes

ClientImportNotes
AsyncPubSubClientfrom kubemq import AsyncPubSubClientEvents + Events Store
AsyncQueuesClientfrom kubemq import AsyncQueuesClientQueues
AsyncCQClientfrom kubemq import AsyncCQClientCommands + Queries

Constructor (illustrative)

AsyncPubSubClient(
    address: str = "localhost:50000",
    client_id: str | None = None,
    auth_token: str | None = None,
    ...
)

Parameters:

NameTypeRequiredDescription
addressstrYesBroker endpoint (host:port)
client_idstrNoAuto-generated when omitted
auth_tokenstrNoBearer token
TLS / cert kwargsvariousNoMutual TLS configuration

Returns: Client instance (connect via async with or await client.connect()).

Throws: KubeMQError subclasses — connection, validation, or auth failures.

Note: Pass AsyncCancellationToken objects into long-running subscriptions to stop workers cooperatively.

Context managers

async with AsyncPubSubClient(address="localhost:50000") as client:
    ...

Quick Usage

app.py
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?

On this page