talus
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
Metadata
Release files for talus 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| talus-0.1.6.tar.gz | 13.0 kB | Details |
Release files / talus-0.1.6.tar.gz
| Download URL | talus-0.1.6.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1413fc9735db390b25151dc377b8b78918898c6811b2cb4c68db311c6dd23dfb
|
|
BLAKE2b-256 checksum How to use checksums |
952ac1ac0372c08368eed5f7279b4c0c740a88ac2d44552b8967a43a935f9f3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|