A python3 client for jetblack-messagebus
Project description
jetblack-messagebus-python3
A Python3 client for the jetblack-messagebus.
Example
The client below subscribes on feed "TEST" to topic "FOO" and prints out the data it receives.
import asyncio
from jetblack_messagebus import CallbackClient
async def on_data(user, host, feed, topic, data_packets, is_image):
print(f'data: user="{user}",host="{host}",feed="{feed}",topic="{topic}",is_image={is_image}')
if not data_packets:
print("no data")
else:
for packet in data_packets:
message = packet.data.decode('utf8') if packet.data else None
print(f'packet: entitlements={packet.entitlements},message={message}')
async def main():
"""Start the demo"""
client = await CallbackClient.create('localhost', 9091)
client.data_handlers.append(on_data)
await client.add_subscription('TEST', 'FOO')
await client.start()
if __name__ == '__main__':
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for jetblack-messagebus-python3-2.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d0f6d9b3c995d36e0a43245a6181c690d6c7197d89ad25860e12806c4edeb11 |
|
MD5 | d454d950fc4c19aabb273557412f9dbf |
|
BLAKE2b-256 | 6fa8d132afbaa3352f923b0b4760b15abe13790454a62bb923f291956a47a838 |
Close
Hashes for jetblack_messagebus_python3-2.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e45d015aafaaa47d81bcca7ff013512b51f682f23330b1ed947870be0132fa00 |
|
MD5 | fce539de71e6b5411bc53f8336a9d8d3 |
|
BLAKE2b-256 | 3cf458f158cdbf2f1db235b6c7ee783bb62a8d4fe84cac5637dd6d9be6d2bfbc |