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

Uploaded Source

Built Distribution

tqp-0.4.12-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tqp-0.4.12.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

Hashes for tqp-0.4.12.tar.gz
Algorithm Hash digest
SHA256 ecb9e424be6b743ae1977f81e2724bef21f944ebd1e59817edb3d588e390d443
MD5 7008a3978d7c448a1005a62ca219a26c
BLAKE2b-256 2c3ed475e601487f85a03052f59790aa9775bc126160940cb2d6659eba240884

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tqp-0.4.12-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

Hashes for tqp-0.4.12-py3-none-any.whl
Algorithm Hash digest
SHA256 956f39bab1b24b0237487fae7daf34300d8a314a5ce118f183a239189977e254
MD5 21c9953090f65432f9a506c2a0da901c
BLAKE2b-256 7e3b3a2f29870e491cc4fd8aee84390d0c6ec14fc42603f0a7fb6beb4fcf41d4

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