A wrapper for connecting to RabbitMQ which constrains clients to a single purpose channel (producer or consumer) with healing for intermittent connectivity.
Project description
talus (noun) - ta·lus | ˈtā-ləs: a slope formed especially by an accumulation of rock debris; Occasional habitat of the pika.
A wrapper for connecting to RabbitMQ which constrains clients to a single purpose channel (producer or consumer) with healing for intermittent connectivity.
Features
Guided separation of connections for producers and consumers
Re-establish connections to the server when lost
Constrained interface to support simple produce / consume use cases for direct exchanges
Installation
pip install talus
Examples
Creating a message class
from talus.message import message_class
@message_class(routing_key="message.m", queues=["message.q"])
class MyMessage:
a: str
Consumer with defaults for connection and retry
with DurableBlockingConsumerWrapper(consumer_queue='queue_name') as consumer:
for method, properties, body in consumer.consume_generator(auto_ack=True):
pass # DO Something with the message
Consumer specifying connection and retry data
with DurableBlockingConsumerWrapper(consumer_queue='queue_name',
rabbitmq_host="localhost",
rabbitmq_port5672,
rabbitmq_user='guest',
rabbitmq_pass='guest',
retry_delay=1,
retry_backoff=2,
retry_jitter=(1, 10),
retry_max_delay=300,
prefetch_count=1,
connection_name='consumer connection') as consumer:
for method, properties, body in consumer.consume_generator(auto_ack=True):
pass # DO Something with the message
Producer with defaults for connection and retry
with DurableBlockingProducerWrapper(producer_queue_bindings=[{"routing_key": "test.m", "bound_queue": "test.q"}, MyMessage.binding()],
publish_exchange='amq.direct') as producer:
producer.post('test.m', {'key': 'value'})
producer.publish_message(MyMessage(a="s")) # using the message class from an earlier example
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
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 talus-1.0.0rc5.tar.gz.
File metadata
- Download URL: talus-1.0.0rc5.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5ea5dee75da3fce4a846d304e10f2ea31af24847813922f7f8081d66fa4c6c0
|
|
| MD5 |
aa30859a5e3e04700d5f1def2c05e158
|
|
| BLAKE2b-256 |
796e22f83fef83b0a3052a6fa7afce2cd6a011d1232b61ea4231b10a70e86414
|
File details
Details for the file talus-1.0.0rc5-py3-none-any.whl.
File metadata
- Download URL: talus-1.0.0rc5-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4577b80904cfbf8c45c1415aed1f130cdfb743085fbb65079197144986090af8
|
|
| MD5 |
ebdfb3dd52830748edab608846c022f9
|
|
| BLAKE2b-256 |
74df015c33094d9a985b20d060da50372afa682edad18b588a5cf208f65114c0
|