Skip to main content

Implementation of rabbitmq with asynqp

Project description

rabbitmq_asynqp

Python package for using rabbitmq using asynqp

Usage:

  • Both producer and consumer:

    rabbitmq_asynqp provides you ability to use rabbitmq messaging asynchronous non-blocking way by the use of asynqp and asyncio with just few lines of code. Typical usage will be like this:

          from rabbitmq_asynqp.messaging import Messaging
    
          rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
          queue_config = dict(
                  exchange="sample_exchange",
                  queues=["sample_queue1"],
                  routing_key="sample.routing_key",
                  exchange_type="direct",
                  error_messaging=dict(
                      exchange="error_exchange",
                      queues=["error_queue"],
                      routing_key="error.key",
                      exchange_type="direct",
                  )
              )
    
          queue_settings = {'reconnect_backoff_secs': 1, 'connection_check_polling_secs': 5} # Not compulsory
    
          def consumer_func(message: dict):
              # define your consumer func
              pass
    
          messaging = Messaging(rabbitmq_config: dict, queue_config: dict, consumer_func)
    

    use this messaging object globally for sending message like this:

          messaging.send_message(message) # To send single message
          messaging.send_messages(messages) # To send multiple bulk messages
    
  • Only Consumer:

    To run only consumer use a separate thread or process and do following:

          from rabbitmq_asynqp.messaging import Consumer
    
          rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
          queue = "queue_name"
          queue_settings = {'reconnect_backoff_secs': 1, 'connection_check_polling_secs': 5} # Not compulsory
    
          def consumer_func(message:dict):
              # define your consumer func
              pass
    
          consumer = Consumer(rabbitmq_config, queue, consumer_func, queue_settings)
          consumer()
    
  • Only Producer:

    To run producer only for message production:

          from rabbitmq_asynqp.messaging import Producer
    
          rabbitmq_config = dict(host="localhost", port=5672, username="guest", password="guest")
          queue_config = dict(
                  exchange="sample_exchange",
                  queues=["sample_queue1"],
                  routing_key="sample.routing_key",
                  exchange_type="direct",
                  error_messaging=dict(
                      exchange="error_exchange",
                      queues=["error_queue"],
                      routing_key="error.key",
                      exchange_type="direct",
                  )
              )
    
          producer = Producer(rabbitmq_config, queue_config)
          producer.send_msg(message)
    

Message sent must be dict.

For any queries, mail to akshay2agarwal@gmail.com

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

rabbitmq_asynqp-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

rabbitmq_asynqp-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file rabbitmq_asynqp-0.1.1.tar.gz.

File metadata

  • Download URL: rabbitmq_asynqp-0.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.2

File hashes

Hashes for rabbitmq_asynqp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8914463224d2b0874c9f9476a9453423f638a1d10517f8fc1fe3f34b80d8db38
MD5 7ee6dfbc62531c3d67c21a79efc0d082
BLAKE2b-256 bbf36d3d825e17df71f62b8ba28226eea34519a2ee61d4e331fc014da5c6f004

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rabbitmq_asynqp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.2

File hashes

Hashes for rabbitmq_asynqp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b927ba2444f1936e435c4c042bae3bb1e611f251e21e17e860bca7190c86504
MD5 3e9e7f678f48481d40f6f81f6f966abd
BLAKE2b-256 55031120f3bf67feaadca99fe31969c4eb16d0ce2491e35da0536757af479328

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