Skip to main content

A message queue system using AWS SQS

Project description

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

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

sqs-mq-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqs_mq-0.1.0-py2-none-any.whl (4.2 kB view details)

Uploaded Python 2

File details

Details for the file sqs-mq-0.1.0.tar.gz.

File metadata

  • Download URL: sqs-mq-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sqs-mq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02fa50a7b654753ad66ce95371b7a280bd415ff2b7e3d1e2dd44d03023d73c18
MD5 9a54c3af2f5c543aa96f9ca2f96db6b5
BLAKE2b-256 801b044bb783390bff5e10d221a25cfcacb8a1b190ed9b1107022f9168fe35a0

See more details on using hashes here.

File details

Details for the file sqs_mq-0.1.0-py2-none-any.whl.

File metadata

  • Download URL: sqs_mq-0.1.0-py2-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 2
  • Uploaded using 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

File hashes

Hashes for sqs_mq-0.1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 ebafef3ca45a1aaede1e5d16cec93a756d3ad506c7d409e81583ed673ef17d52
MD5 d1a046ffb5b9659a98e741f0fedbc2bd
BLAKE2b-256 c03bf40b57801f9f7f2ac5b29c9b88ca5f1cb42afd233efacc1805edfa4cfea5

See more details on using hashes here.

Supported by

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