Relaybus AMQP subscriber
Project description
relaybus-amqp (Python)
AMQP publisher and subscriber utilities for Relaybus.
Install
pip install relaybus-amqp
Example
Publisher will assert the exchange/queue on first publish (defaults: exchange_type="topic", queue=topic).
from relaybus_amqp import (
AmqpPublisher,
AmqpPublisherConnectConfig,
AmqpSubscriber,
AmqpSubscriberConnectConfig,
)
from relaybus_core import OutgoingMessage
exchange = "relaybus.events"
queue = "relaybus.demo"
publisher = AmqpPublisher.connect(
AmqpPublisherConnectConfig(
url="amqp://guest:guest@localhost:5672/",
exchange=exchange,
exchange_type="topic",
queue=queue,
)
)
publisher.publish("relaybus.demo", OutgoingMessage(topic="relaybus.demo", payload=b"hello"))
publisher.close()
subscriber = AmqpSubscriber.connect(
AmqpSubscriberConnectConfig(
url="amqp://guest:guest@localhost:5672/",
exchange=exchange,
queue=queue,
on_message=lambda msg: print(msg.topic, msg.payload),
)
)
subscriber.start("relaybus.demo")
subscriber.close()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
relaybus_amqp-0.0.8.tar.gz
(5.1 kB
view details)
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 relaybus_amqp-0.0.8.tar.gz.
File metadata
- Download URL: relaybus_amqp-0.0.8.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
563f723164b759361c90d8d9c8ce58b82b4ae20b7316295321ea495ae017e382
|
|
| MD5 |
eb65dcb0f80b25bf48b77d4142a77465
|
|
| BLAKE2b-256 |
f2e516eff31442265a513f91583b2a584ef6c528f8fd0ec785a0fbeeadebc0c9
|
File details
Details for the file relaybus_amqp-0.0.8-py3-none-any.whl.
File metadata
- Download URL: relaybus_amqp-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9a5191141d9848397529b581e6dfe755400714d1a0db22bea6f3cc78e224597
|
|
| MD5 |
cd02c0613feb4438b259681a86084668
|
|
| BLAKE2b-256 |
2b77220ada0131c6db9fcd5807363c591240125dcc93509ad1bce48b94b3e2d5
|