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='oscar.fernandez@grupotks.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 Distribution
tks_simple_pika-0.0.2.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for tks_simple_pika-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f1196939e1864c3b8ed9ecff9b284aa7a02f1dec9ae4d8c9fbff332e387dc2 |
|
MD5 | 03825a03583d04737306cf7be5af7083 |
|
BLAKE2b-256 | ac1b7e330ef369707c3b0de45efa009feae945c55aaa1a184ae0ae95df4f522d |