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.1.tar.gz
(2.0 kB
view hashes)
Built Distributions
Close
Hashes for tks_simple_pika-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5195fcecb7e9717fb288a1d56e82a9715a236eb0aa2c65357d0115b5fe822532 |
|
MD5 | 8b27710b5cbc3eb9b63d135f3a36b1b1 |
|
BLAKE2b-256 | afb9080e9f9dd93565b957c78df5e9e586c88d16a6c74a8aa6860d009d934b1b |
Close
Hashes for tks_simple_pika-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61c1f317493133aff8b2fdab8c20868742b147d7a68c3cc6a825ce42c785886 |
|
MD5 | 8f84be954da0b478b1b5dcb8212a9299 |
|
BLAKE2b-256 | 9ab6b59f47c9cb195af3024a4d9161cd97f5bd050e0c657e4b3705e202ed5966 |