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.10.tar.gz
(7.1 kB
view details)
Built Distribution
tqp-0.4.10-py3-none-any.whl
(8.8 kB
view details)
File details
Details for the file tqp-0.4.10.tar.gz
.
File metadata
- Download URL: tqp-0.4.10.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cdf8dc579d45ef50de50fc2da93f659a087a615d94da25452a1209ef69d20a9 |
|
MD5 | 2fea463d23bf09ce81c873688b47dcec |
|
BLAKE2b-256 | 24430a2caa95ac283a45a81aee3a9e36ed831911ce1d43eb1c44e2704b172c1a |
File details
Details for the file tqp-0.4.10-py3-none-any.whl
.
File metadata
- Download URL: tqp-0.4.10-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8562ca76d4409de5c70468457add244e99d92085b8fe5434d862535454c1c6 |
|
MD5 | 4614ca9c9142d2eca58eacdb7fc368f9 |
|
BLAKE2b-256 | 090e3f5d423a23ab9e2db09fa201c2846f8a3eb8feaaba0453ad3c4d3e3c825f |