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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tqp-0.4.8.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.8.tar.gz
Algorithm Hash digest
SHA256 3586ae415543830bd34a9dd40771f570207185ef98a9a363ac3c2f6e55416ea3
MD5 e675adfde272f258476075f66fb5bea1
BLAKE2b-256 ede16609d3ff397383db2d37f1e60b9d65317e26a1710924c9b867187a619f5d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tqp-0.4.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0c713eaf9382728a453bb3ca80847bc65c3f2816e2a45c8f15d803c1b4e6c1a5
MD5 b1213b4bee8832cadd81ae2d0128e93c
BLAKE2b-256 f870a9c422aea502b7f27bcb35c9bb94c0f1924d2f5fe1e2272518e44470bc1a

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