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
Release history Release notifications | RSS feed
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
Close
Hashes for tks_simple_pika-1.1.8-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bfd8d981a8c388585d9313d494b6653634cd2e742b8847dae93f3b6fcf76243 |
|
MD5 | ef7f43800ac4023cd571ceb4fb846c17 |
|
BLAKE2b-256 | 10be1408be4d06033bd8fda18d5b5216e90e64c4c7fb2e8e350811f30ad91ade |