Skip to main content

RabbitMQ throw & catch messages

Project description

RabbitMQ throw & catch messages

Install

To install run:

pip install throw-catch

Add the following line at the top of your *.py file:

from throw_catch import throw, catch 

Now you can send messages to RabbitMQ queue amq.direct.throw_catch (by default):

import os
AMQP_URI = os.getenv("AMQP_URI")

payload = {"hello": "world"}  
throw(payload=payload, uri=AMQP_URI) 
throw(payload=payload, uri=AMQP_URI, routing_key="some_routing_key") # custom routing key (direct)
for _ in range(10):
    throw(payload=payload, tag="some_tag", uri=AMQP_URI, routing_key="some_routing_key") # custom tag && custom routing key

Catch messages from RabbitMQ:

import os
AMQP_URI = os.getenv("AMQP_URI")

catch(uri=AMQP_URI) # {"hello": "world"} 
catch(uri=AMQP_URI, queue="some_routing_key") # catch 10 messages from `some_routing_key` queue (direct) 
catch(tag="some_tag", uri=AMQP_URI, queue="some_routing_key", count=10) # catch 10 messages from `some_routing_key` queue (direct) with tag `some_tag`

Test

tox

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

throw_catch-0.1.1-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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