Skip to main content

SQS-MQ

A message queue system using AWS SQS

Features

  • Automatically process messages
  • Created completed and failed buckets
  • Create bucket by pool name
  • Process messages by bucket

Install

pip install sqs-mq

Create/Connect

mq = SQSMQ(name, 
          aws_access_key_id, 
          aws_secret_access_key, 
          region, 
          visibility_timeout)

Alternatively, connect later

mq = SQSMQ(name)

mq.connect(aws_access_key_id, 
          aws_secret_access_key, 
          region)

SQS-MQ will create 3 buckets of messages:

QUEUED: This bucket will contain all the messages to be processed

COMPLETED: contains all messages that have have processed successfully

FAILED: contains all messages that have failed to process properly, or due to an error.

mq = SQSMQ("myQname", **kwargs)

Three buckets will be created: myQname-QUEUED, myQname-COMPLETED, myQname-FAILED


Usage

Add Task

mq.add(my_function_name, *args, **kwargs)

Add Task in different pool

To add a task in a different pool. it will be named: myQname-QUEUED-FAST

mq.add(my_fn, *args, **kwargs, pool='FAST')

Add delay

To add a delay

mq.add(my_fn, delay=45)

Run the tasks

Run all

mq.run()

Run by pool name

mq.run(pool='FAST')

COMPLETED and FAILED

Once a tasks have been processed, it will be added in either COMPLETED or FAILED buckets.

Run all items in the COMPLETED bucket

def completed_callback(body:dict): 
  data = ...

mq.run_completed(callback=completed_callback)

Run all items in the FAILED bucket

def failed_callback(body:dict): 
  data = ...

mq.run_failed(callback=failed_callback)

Once captured, it will delete the message from the queue

Metadata

Release files for sqs-mq 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqs-mq 0.2.1
File Size Uploaded
sqs-mq-0.2.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqs-mq 0.2.1
File Interpreter ABI Platform
sqs_mq-0.2.1-py2-none-any.whl Python 2 none any Details

Total release size: 8.7 kB

Release files / sqs-mq-0.2.1.tar.gz

Download URL sqs-mq-0.2.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b28e8b960457761b24ce38f9c58d0bd76e6ca57659285c021b85c1463accb5c1
BLAKE2b-256 checksum
How to use checksums
b18dd373daf80b9dd865d1725d9e55f0364c83747544250ecaa562f449cf615d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.17.3 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

Release files / sqs_mq-0.2.1-py2-none-any.whl

Download URL sqs_mq-0.2.1-py2-none-any.whl
Size 4.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
067a4fb72ce653dd671b90b3a4b95e87046b02d97cf5ec0ec1e769275b3a29d7
BLAKE2b-256 checksum
How to use checksums
5ec6374af7bb38f61b6f528a0ace34eaf5a6515d1993f12f48414c81895b1710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.17.3 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.13

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page