An opinionated library for pub/sub over SQS and SNS
Project description
TQP
An opinionated library for pub/sub over SQS and SNS
Topic
To publish on a topic:
topic = Topic('widgets--created')
topic.publish({'id': '123456'})
Topic Queue Poller
To read from the topic:
poller = TopicQueuePoller('my_poller')
@poller.handler('widgets--created')
def process_created_widget(item):
widget_id = item['id']
print(f'Widget {widget_id} was created')
poller.start()
Flask
A Flask binding is also provided:
poller = FlaskTopicQueuePoller('my_poller', app=flask_app)
When using the Flask poller, you can also specify how to format the logs:
# the argument (optional) is a function that takes the message payload as input and return a message identifier
poller.set_log_formatter(lambda payload: payload["message"].get("id", "<NO ID>"))
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
tqp-0.4.11.tar.gz
(7.3 kB
view details)
Built Distribution
tqp-0.4.11-py3-none-any.whl
(9.1 kB
view details)
File details
Details for the file tqp-0.4.11.tar.gz
.
File metadata
- Download URL: tqp-0.4.11.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad1afcba18512f994249a37e2a517fb6fbab50e5b47b7d8f7b53e42280b6627 |
|
MD5 | 24f0d0e026225bce2e5166dd3a89e98a |
|
BLAKE2b-256 | 592a2501905509298682313792e9ff8606cbe19196330c2c854bb53800946182 |
File details
Details for the file tqp-0.4.11-py3-none-any.whl
.
File metadata
- Download URL: tqp-0.4.11-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eea6c0b4654eeb280c60edfe6bb362285667f3391c95d9cc4a0421ab7419008c |
|
MD5 | 811dbe3f20d7b447fd65a28597fadd02 |
|
BLAKE2b-256 | 960cb2ea38642762acefe54d5369a47baac3ba5ef2261abda100372bb297b560 |