Skip to main content

Library for a simple implementation of a RabbitMQ consumer and producer using the python pika library

Project description

Features

Library for a simple implementation of a RabbitMQ consumer and producer using the python pika library

Editor.md

This library includes the pika library and only the following steps are necessary:

  • call to the generator or consumer class if applicable. To consumer: (Make a call to the consumer class and override the callback method with the required business logic.) consumer = TksSimplePikaConsumer('exchange_name') funcType = type(TksSimplePikaConsumer.callback) def __callback(self, ch, method, properties, body): print(" [x] %r %s %s %s" % (body, ch, method, properties)) data = json.loads(body) notification = Notifications(**data) notification.raiseNotification() consumer.callback = __callback.get(consumer,TksSimplePikaConsumer) consumer.consumer_start() To generator (message example): publisher = TksSimplePikaPublisher('notifications', id=1, email='johndoe@email.com', type='email', msg='Test message') publisher.send() The following parameters are required:: - id (int) - type (str) - msg (str) Optional parameters: - email (EmailStr) - subject (str) - phone (int) - description (str)
  • The following environment variables are required (Would be in an .env file):
    • RABBITMQ_HOST
    • RABBITMQ_PORT
    • RABBITMQ_USER
    • RABBITMQ_PASSWORD
    • RABBITMQ_EXCHANGE_TYPE (funout)

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

tks_simple_pika-0.1.7-py2.py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 2 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