Skip to main content

A wrapper for connecting to RabbitMQ which constrains clients to a single purpose channel (producer or consumer) with healing for intermittent connectivity.

Project description

codecov

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

talus-1.0.0rc3.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

talus-1.0.0rc3-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file talus-1.0.0rc3.tar.gz.

File metadata

  • Download URL: talus-1.0.0rc3.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for talus-1.0.0rc3.tar.gz
Algorithm Hash digest
SHA256 a27f2c8467de98f2910b5d1e7ce83101d501ec0deeff8d36539b0e170947b1d2
MD5 697885cff67d802fcf46ec8a16f43eaa
BLAKE2b-256 45cff32384216eb38337dae42b980a5ce11d0e935e4bd28659566bfa39837fff

See more details on using hashes here.

Provenance

File details

Details for the file talus-1.0.0rc3-py3-none-any.whl.

File metadata

  • Download URL: talus-1.0.0rc3-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for talus-1.0.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 40b2a3a4f65e00d622dbe0edd3224e599cfa0eda6292760353b56574858c3786
MD5 ab53eb0a4ec8ebcc2b1c156c65612c49
BLAKE2b-256 f4a2341db74935f426eae0707533b187a9767f5b8244b0317b92bac5eb523b26

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page