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

If you're not sure about the file name format, learn more about wheel file names.

throw_catch-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: throw_catch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for throw_catch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f602f814518086149be5f1539ed300d70fdf9e06f5abff9f50e48703cc7cfc8
MD5 55d17f5ef70c3de15484a817dd4e84ce
BLAKE2b-256 6424dfb5cb92f0caf6df3ab290d9b366b8ded63855e890c839535c839a7402ec

See more details on using hashes here.

Supported by

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