Skip to main content

Azure Queue Brokers for Dramatiq

Project description

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) !

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_azure-1.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

dramatiq_azure-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file dramatiq_azure-1.0.0.tar.gz.

File metadata

  • Download URL: dramatiq_azure-1.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for dramatiq_azure-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8c83edda9e27d2c1b5f02280cbf2385e02db03e1a00ba41bec9dea44abef0f79
MD5 a845d56f1a8017927420e48654adf711
BLAKE2b-256 3339e7b09c89ea4d79875c96cf83e0cda01f17eba1afc0f81765e28f93915a2b

See more details on using hashes here.

File details

Details for the file dramatiq_azure-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dramatiq_azure-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure

File hashes

Hashes for dramatiq_azure-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b3111c73e59d974aadff3c71f27d5632dccb3f032890a669e82b58b34ebee4f
MD5 08e581b881b847ab7617c9cd771a31fa
BLAKE2b-256 4ca0595fc26712847460bc1520bbd51e75657bb6dcecc540afb3333d193d5618

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