Skip to main content

cangling-broker (Python)

Producer and consumer for cangling-broker. Same contract as the Java client: AcceptMessages to publish, Subscribe to consume, optional Register metadata, CL_BROKER_AUTH_TOKEN on every RPC.

Install

pip install cangling-broker

From this tree:

pip install -e python

Use

from cangling_broker import SatwayClient, SubscribeOptions

with SatwayClient.connect("127.0.0.1:7500", "change-me") as client:
    client.send("cangling-test", "hello")
    with client.subscribe(
        SubscribeOptions(topic="cangling-test", name="worker-1"),
        lambda message: print(message.id, message.payload),
    ):
        ...

SatwayClient.connect(broker) also reads CL_BROKER_AUTH_TOKEN from the environment.

Batch-set topic delivery (single = one consumer, broadcast = every live stream) and persistence (persistent = queue for later, ephemeral = drop if nobody is subscribed):

from cangling_broker import TopicConfig

client.configure_topics([
    TopicConfig("jobs", "single"),
    TopicConfig("alerts", "broadcast"),
    TopicConfig("live-events", "broadcast", "ephemeral"),
])
print(client.list_topics())

Existing Kafka senders can keep send(topic, value) / flush():

# from kafka import KafkaProducer
from cangling_broker import KafkaProducer

producer = KafkaProducer(bootstrap_servers="127.0.0.1:7500")
producer.send(topic, msg)
producer.flush()
# consume
python python/examples/consumer.py --broker 127.0.0.1:7500 --topic cangling-test --name py-s0 --token change-me

# produce
python python/examples/producer.py --broker 127.0.0.1:7500 --topic cangling-test --text hello --count 1 --token change-me

Publish to PyPI

CI on tag v* builds the package and uploads with pypa/gh-action-pypi-publish. Set repository secret PYPI_API_TOKEN.

cd python
python generate_proto.py
python -m build

Release files for cangling-broker 0.1.58

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cangling-broker 0.1.58
File Size Uploaded
cangling_broker-0.1.58.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cangling-broker 0.1.58
File Interpreter ABI Platform
cangling_broker-0.1.58-py3-none-any.whl Python 3 none any Details

Total release size: 30.4 kB

Release files / cangling_broker-0.1.58.tar.gz

Download URL cangling_broker-0.1.58.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ecc9618383a07aa46a4834cb792e86cbf71eeac7550428562f3096d0d47f57d5
BLAKE2b-256 checksum
How to use checksums
b12dc284d7d9f5f4cb03dc55fe4dae0430a6c8e658b9abaa5a82c924541ce0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / cangling_broker-0.1.58-py3-none-any.whl

Download URL cangling_broker-0.1.58-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9eba0652c3280f8f10a780d52593983b84f5f1c81c8e01cbd45db60c5b7ae6e
BLAKE2b-256 checksum
How to use checksums
e64d4d274bb1f059fc2abcfdfe1f268402f9276d0196a907e89fa64dd1c41e88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.1.59

2 release files

This release

0.1.58 This release

2 release files

0.1.57

2 release files

0.1.56

2 release files

0.1.55

2 release files

0.1.54

2 release files

0.1.51

2 release files

0.1.50

2 release files

0.1.49

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.42

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.37

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.30

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page