cangling-message (Python)
Producer and consumer for the cangling-message broker. Same contract as the Java client: AcceptMessages to publish, Subscribe to consume, optional Register metadata, AUTH_TOKEN on every RPC.
Install
pip install cangling-message
From this tree:
pip install -e python
Use
from cangling_message 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 AUTH_TOKEN from the environment.
Batch-set topic delivery (single = one consumer, broadcast = every live stream):
from cangling_message import TopicConfig
client.configure_topics([
TopicConfig("jobs", "single"),
TopicConfig("alerts", "broadcast"),
])
print(client.list_topics())
Existing Kafka senders can keep send(topic, value) / flush():
# from kafka import KafkaProducer
from cangling_message 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cangling_message-0.1.9.tar.gz.
File metadata
- Download URL: cangling_message-0.1.9.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a10b45a01e33e9bf003eb1cca3cd1169b11be50ca2c9745a67c89e0220019cd
|
|
| MD5 |
968fb1365639d55523b5980820f0c426
|
|
| BLAKE2b-256 |
d2607a3b47706f76c7649fc8e6ecd8be1624114b7fee2ce6b2877f2f0274a041
|
File details
Details for the file cangling_message-0.1.9-py3-none-any.whl.
File metadata
- Download URL: cangling_message-0.1.9-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
762d47eed443f2863a4f2d4c1fe3208a345428106b1a2ce54e7d222dd4436621
|
|
| MD5 |
ecdd3a720a62bc1ab5cc328c5a907c7e
|
|
| BLAKE2b-256 |
26a1d4bb1f74d47ea8e2a5f407c5e100b32740c532d38638acec63e91f034de5
|