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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cangling_broker-0.1.50.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cangling_broker-0.1.50-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file cangling_broker-0.1.50.tar.gz.

File metadata

  • Download URL: cangling_broker-0.1.50.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cangling_broker-0.1.50.tar.gz
Algorithm Hash digest
SHA256 d876d8d6b81d4f1a9a24ff8b2842f1757cd42c6e2513b6a19657ce87ba55d949
MD5 4f44243a2034110b993155fabf56d6c3
BLAKE2b-256 d695da40914d828b29f9b51d776fc107b5b6a16bb0f9a844911b5b1488d80b4b

See more details on using hashes here.

File details

Details for the file cangling_broker-0.1.50-py3-none-any.whl.

File metadata

File hashes

Hashes for cangling_broker-0.1.50-py3-none-any.whl
Algorithm Hash digest
SHA256 d971f24b9d4c4c44f7867208d4e6ce206f8188603ed89e0d7b5cf1dd32a9b661
MD5 3d5d88997c3e559a568ff6b5eb69a021
BLAKE2b-256 c347a61ee5e20a0716994669cdba0259882572135b5d470c6d77e9eef88c7332

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.53

2 files

0.1.52

2 files

0.1.51

2 files

This release

0.1.50 This release

2 files

0.1.49

2 files

0.1.48

2 files

0.1.47

2 files

0.1.45

2 files

0.1.44

2 files

0.1.43

2 files

0.1.42

2 files

0.1.41

2 files

0.1.40

2 files

0.1.39

2 files

0.1.38

2 files

0.1.37

2 files

0.1.36

2 files

0.1.35

2 files

0.1.34

2 files

0.1.33

2 files

0.1.32

2 files

0.1.31

2 files

0.1.30

2 files

0.1.29

2 files

0.1.28

2 files

0.1.27

2 files

0.1.26

2 files

0.1.25

2 files

0.1.24

2 files

0.1.23

2 files

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 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