Skip to main content

dramatiq-azure

CI PyPI version codecov Code style: black PRs Welcome

A Dramatiq broker that can be used with Microsoft Azure queue services.

Heavily inspired by Dramatiq SQS, this package currently implements a broker for Azure Storage Queue. An implementation for Azure Service Bus is planned... eventually.

Installation

    pip install dramatiq-azure
    pip install dramatiq-azure[identity]  # for passwordless authentication

Usage

ASQBroker

import dramatiq

from dramatiq.middleware import AgeLimit, TimeLimit, Callbacks, Pipelines, Prometheus, Retries
from dramatiq_azure import ASQBroker


broker = ASQBroker(
    dead_letter=True,
    middleware=[
        Prometheus(),
        AgeLimit(),
        TimeLimit(),
        Callbacks(),
        Pipelines(),
        Retries(min_backoff=1000, max_backoff=900000, max_retries=96),
    ],
)
dramatiq.set_broker(broker)

Authentication

The following authentication methods are supported by the broker:

  1. Connection string based: AZURE_STORAGE_CONNECTION_STR environment variable must be set. If this variable is not set, passwordless authentication will be used. Creating a connection string for your Azure account is documented here.
  2. Passwordless (token-based) authentication (Recommended): AZURE_STORAGE_ACCOUNT_NAME environment variable must be set.

The list of other mandatory variables depends on where the app is being run. More information can be found here.

Environment variables

The following environment variables can be used to configure the broker:

  • AZURE_STORAGE_CONNECTION_STR: Azure Storage connection string;
  • AZURE_STORAGE_ACCOUNT_NAME/AZURE_ACCOUNT_NAME: Azure Storage account name;
  • AZURE_ENDPOINT_SUFFIX: Azure Storage endpoint suffix;
  • AZURE_SSL: Whether to use SSL for the connection;
  • AZURE_QUEUE_ACCOUNT_URL: Azure Storage account URL;
  • DRAMATIQ_ASQ_MIN_TIMEOUT: The minimum time to wait between polls in second.

Contributions

Found an itch you know how to scratch? PR welcome (just remember to read the contribution guide) !

Release files for dramatiq_azure 2.0.0

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

Source distribution (sdist)

Source distribution for dramatiq_azure 2.0.0
File Size Uploaded
dramatiq_azure-2.0.0.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dramatiq_azure 2.0.0
File Interpreter ABI Platform
dramatiq_azure-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / dramatiq_azure-2.0.0.tar.gz

Download URL dramatiq_azure-2.0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d92db05f84d72888bcfe49474bfa399547d13e491fcf3cb149d2fdf345c30afc
BLAKE2b-256 checksum
How to use checksums
0d8941eabc6b8cd6bcbc17534a8c6cc76d9c825f581b9193eee58fc725d00fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.21 Linux/6.17.0-1022-azure

Release files / dramatiq_azure-2.0.0-py3-none-any.whl

Download URL dramatiq_azure-2.0.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb31f339d0d361707b3a42f19430590ed51464cca3ccbaf2adb4d37354f03c4d
BLAKE2b-256 checksum
How to use checksums
d1970c308411cfc6c020d0f057268f8c17296bdaea41d453c2847511db82ffac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.21 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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