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 details)

Uploaded Python 3

File details

Details for the file throw_catch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: throw_catch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for throw_catch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6e072f295b9fef8e41ccf832a5d31a24d5f0b2f76327bcf35e888606cbf531b
MD5 cabc39c03053b4dd52ca8e9181e31cc9
BLAKE2b-256 1ab79a54f6f48839ef4459838b671446bdd7bb0a8a8bcf5c262afb0339789650

See more details on using hashes here.

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