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.4.tar.gz
(5.9 kB
view details)
Built Distribution
tqp-0.4.4-py3-none-any.whl
(7.4 kB
view details)
File details
Details for the file tqp-0.4.4.tar.gz
.
File metadata
- Download URL: tqp-0.4.4.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a738c9569abdb5ebc3d16fafb152e9fd7c3d8df99f8f1deb5c954c98bb27351 |
|
MD5 | 2ae63710e57479283af1318252bee5cc |
|
BLAKE2b-256 | e157a2f4252899a1c511eaf9114afebe99c528fd8f5c18edc8ef2e6b7de26d32 |
File details
Details for the file tqp-0.4.4-py3-none-any.whl
.
File metadata
- Download URL: tqp-0.4.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01faf3ab13663bb7b4ab039a7b62e7ec0b76904bef20dc5e8e4196ca9991eb18 |
|
MD5 | 827a27576fe53736825f9e8f1ae82e76 |
|
BLAKE2b-256 | b7853c5faf652d1fc9eceb195cbf55574d0aabfa8e8ca1ee13144e4daa0316d0 |