Skip to main content

An Amazon SQS broker for Dramatiq.

Project description

dramatiq_sqs

A Dramatiq broker that can be used with Amazon SQS.

This backend has a number of limitations compared to the built-in Redis and RMQ backends:

  • the max amount of time messages can be delayed by is 15 minutes,
  • messages can be at most 1MiB large and
  • messages must be processed within 12 hours of being pulled, otherwise they will be redelivered.

The backend uses boto3 under the hood. For details on how authorization works, check out its docs.

Installation

pip install dramatiq_sqs

Usage

import dramatiq

from dramatiq.middleware import AgeLimit, TimeLimit, Callbacks, Pipelines, Prometheus, Retries
from dramatiq_sqs import SQSBroker

broker = SQSBroker(
    namespace="dramatiq_sqs_tests",
    middleware=[
        Prometheus(),
        AgeLimit(),
        TimeLimit(),
        Callbacks(),
        Pipelines(),
        Retries(min_backoff=1000, max_backoff=900000, max_retries=96),
    ],
)
dramatiq.set_broker(broker)

Usage with ElasticMQ

broker = SQSBroker(
    # ...
    endpoint_url="http://127.0.0.1:9324",
)

Example IAM Policy

Here are the IAM permissions needed by Dramatiq:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sqs:CreateQueue",
                "sqs:ReceiveMessage",
                "sqs:DeleteMessage",
                "sqs:DeleteMessageBatch",
                "sqs:SendMessage",
                "sqs:SendMessageBatch"
            ],
            "Resource": ["*"]
        }
    ]
}

License

dramatiq_sqs is licensed under Apache 2.0.

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

dramatiq_sqs-0.3.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

dramatiq_sqs-0.3.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dramatiq_sqs-0.3.1.tar.gz.

File metadata

  • Download URL: dramatiq_sqs-0.3.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for dramatiq_sqs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 cb0cfc2aaca1c4cc98f89e33d72997094a1a1250046ce571a0af23b191218ecc
MD5 d4c2ca676ec7bea9547ef4e72f09e9f5
BLAKE2b-256 5b44fe020ab8a0880cc072278340ec2c49686fe7f9552769663a15e4f0518958

See more details on using hashes here.

File details

Details for the file dramatiq_sqs-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dramatiq_sqs-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e51470a42ca31b2117ab4aa1601836441cb3c9e538e3ce7e9fc611b343411ffa
MD5 0fc8f9fccaf997cc1d12680b751aa132
BLAKE2b-256 9e5f377ccd388240bd58652bfdc3bb91450f36853f0e515520b55d04c53cf371

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