Skip to main content

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


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.7.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

tqp-0.4.7-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file tqp-0.4.7.tar.gz.

File metadata

  • Download URL: tqp-0.4.7.tar.gz
  • Upload date:
  • Size: 7.1 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

Hashes for tqp-0.4.7.tar.gz
Algorithm Hash digest
SHA256 dec2437db092733f41e79ad531cf555afa447f1adda72b1fa01d1b51048b28fd
MD5 cde7e4496d5bb7b4d586fd8e1c26b996
BLAKE2b-256 f139bfb933a9ec6a95f9d9f5368920537ac22e0ac50a3f5cd625688407e4fcd7

See more details on using hashes here.

File details

Details for the file tqp-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: tqp-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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

Hashes for tqp-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 53fc60d55a8c0505f7e82ffb313e5b2f419a975f19baae05f3508cf7a25ef5f5
MD5 ee7a3d6861f010e72d70de86a40aa8a3
BLAKE2b-256 93d18793a275ae833835d8b6e7b55b637bec11507ff273c78e99a9d0fc98d6c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page