# dramatiq-azure
[![CI](https://github.com/bidossessi/dramatiq-azure/actions/workflows/ci.yml/badge.svg)](https://github.com/bidossessi/dramatiq-azure/actions/workflows/ci.yml)
[![Pypi](https://github.com/bidossessi/dramatiq-azure/actions/workflows/python-publish.yml/badge.svg)](https://github.com/bidossessi/dramatiq-azure/actions/workflows/python-publish.yml)
[![codecov](https://codecov.io/gh/bidossessi/dramatiq-azure/branch/main/graph/badge.svg?token=6LLEDAM3SG)](https://codecov.io/gh/bidossessi/dramatiq-azure)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
A [Dramatiq](https://dramatiq.io) broker that can be used with [Microsoft Azure](https://azure.microsoft.com/en-us/) queue services.
Heavily inspired by [Dramatiq SQS](https://github.com/Bogdanp/dramatiq_sqs), this package currently implements a broker for [Azure Storage Queue](https://docs.microsoft.com/en-us/azure/storage/queues/).
An implementation for [Azure Service Bus](https://docs.microsoft.com/en-us/azure/service-bus-messaging/) is planned... eventually.
## Installation
```shell
pip install dramatiq-azure
pip install dramatiq-azure[identity] # for passwordless authentication
```
## Usage
### ASQBroker
```python
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](https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string).
2. [Passwordless](https://learn.microsoft.com/en-us/azure/developer/python/sdk/authentication-overview#recommended-app-authentication-approach) (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](https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-python?tabs=passwordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#authenticate-to-azure).
### 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.
## Tests
Tests require a running [Azurite](https://github.com/Azure/Azurite) instance. You can easily launch `azurite` through [Docker](https://www.docker.com/).
```shell
docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
```
Run the test suite
```shell
pytest
```
## Contributions
Found an itch you know how to scratch? PR welcome (just remember to read the
[contribution guide](CONTRIBUTING.md)) !
Raw data
{
"_id": null,
"home_page": "https://github.com/bidossessi/dramatiq-azure",
"name": "dramatiq_azure",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "dramatiq,azure,queue,broker",
"author": "Stanislas H.B. Sodonon",
"author_email": "stanislas.sodonon@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0d/1e/85695f047749b1c03d91a0d8c19a4f9cabeb5a17423e1e4740865cd30345/dramatiq_azure-0.3.1.tar.gz",
"platform": null,
"description": "# dramatiq-azure\n[![CI](https://github.com/bidossessi/dramatiq-azure/actions/workflows/ci.yml/badge.svg)](https://github.com/bidossessi/dramatiq-azure/actions/workflows/ci.yml)\n[![Pypi](https://github.com/bidossessi/dramatiq-azure/actions/workflows/python-publish.yml/badge.svg)](https://github.com/bidossessi/dramatiq-azure/actions/workflows/python-publish.yml)\n[![codecov](https://codecov.io/gh/bidossessi/dramatiq-azure/branch/main/graph/badge.svg?token=6LLEDAM3SG)](https://codecov.io/gh/bidossessi/dramatiq-azure)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)\n\n\nA [Dramatiq](https://dramatiq.io) broker that can be used with [Microsoft Azure](https://azure.microsoft.com/en-us/) queue services.\n\nHeavily inspired by [Dramatiq SQS](https://github.com/Bogdanp/dramatiq_sqs), this package currently implements a broker for [Azure Storage Queue](https://docs.microsoft.com/en-us/azure/storage/queues/).\nAn implementation for [Azure Service Bus](https://docs.microsoft.com/en-us/azure/service-bus-messaging/) is planned... eventually.\n\n\n## Installation\n\n```shell\n pip install dramatiq-azure\n pip install dramatiq-azure[identity] # for passwordless authentication\n```\n## Usage\n\n### ASQBroker\n\n```python\nimport dramatiq\n\nfrom dramatiq.middleware import AgeLimit, TimeLimit, Callbacks, Pipelines, Prometheus, Retries\nfrom dramatiq_azure import ASQBroker\n\n\nbroker = ASQBroker(\n dead_letter=True,\n middleware=[\n Prometheus(),\n AgeLimit(),\n TimeLimit(),\n Callbacks(),\n Pipelines(),\n Retries(min_backoff=1000, max_backoff=900000, max_retries=96),\n ],\n)\ndramatiq.set_broker(broker)\n```\n\n### Authentication\n\nThe following authentication methods are supported by the broker:\n1. Connection string based: `AZURE_STORAGE_CONNECTION_STR` environment variable must be set.\nIf this variable is not set, passwordless authentication will be used.\nCreating a connection string for your Azure account is documented [here](https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string).\n2. [Passwordless](https://learn.microsoft.com/en-us/azure/developer/python/sdk/authentication-overview#recommended-app-authentication-approach) (token-based) authentication **(Recommended)**: `AZURE_STORAGE_ACCOUNT_NAME` environment variable must be set.\n\nThe list of other mandatory variables depends on where the app is being run.\nMore information can be found [here](https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-python?tabs=passwordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#authenticate-to-azure).\n\n### Environment variables\n\nThe following environment variables can be used to configure the broker:\n- `AZURE_STORAGE_CONNECTION_STR`: Azure Storage connection string;\n- `AZURE_STORAGE_ACCOUNT_NAME`/`AZURE_ACCOUNT_NAME`: Azure Storage account name;\n- `AZURE_ENDPOINT_SUFFIX`: Azure Storage endpoint suffix;\n- `AZURE_SSL`: Whether to use SSL for the connection;\n- `AZURE_QUEUE_ACCOUNT_URL`: Azure Storage account URL;\n- `DRAMATIQ_ASQ_MIN_TIMEOUT`: The minimum time to wait between polls in second.\n\n## Tests\n\nTests require a running [Azurite](https://github.com/Azure/Azurite) instance. You can easily launch `azurite` through [Docker](https://www.docker.com/).\n\n```shell\ndocker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite\n```\n\nRun the test suite\n\n```shell\npytest\n```\n\n## Contributions\n\nFound an itch you know how to scratch? PR welcome (just remember to read the\n[contribution guide](CONTRIBUTING.md)) !\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Azure Queue Brokers for Dramatiq",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/bidossessi/dramatiq-azure",
"Repository": "https://github.com/bidossessi/dramatiq-azure"
},
"split_keywords": [
"dramatiq",
"azure",
"queue",
"broker"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "524f4c9acd9fcdb22a55fedce94f2a9031d6ee80b17222e4b8730b63a7281727",
"md5": "72b6c76bb1b5d37d4ba88f36481f3a89",
"sha256": "f25d5020952c91249d230560740b881f8c541a780787e1dd10fa105b1c5dd13c"
},
"downloads": -1,
"filename": "dramatiq_azure-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72b6c76bb1b5d37d4ba88f36481f3a89",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 10059,
"upload_time": "2023-09-01T10:04:45",
"upload_time_iso_8601": "2023-09-01T10:04:45.987539Z",
"url": "https://files.pythonhosted.org/packages/52/4f/4c9acd9fcdb22a55fedce94f2a9031d6ee80b17222e4b8730b63a7281727/dramatiq_azure-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0d1e85695f047749b1c03d91a0d8c19a4f9cabeb5a17423e1e4740865cd30345",
"md5": "c277919edce265f92ad015910d0e3b41",
"sha256": "60b446642ded4ee7404f20758bc240966d2e9a185033999c4d4f523c960f0c40"
},
"downloads": -1,
"filename": "dramatiq_azure-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "c277919edce265f92ad015910d0e3b41",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 9404,
"upload_time": "2023-09-01T10:04:47",
"upload_time_iso_8601": "2023-09-01T10:04:47.455719Z",
"url": "https://files.pythonhosted.org/packages/0d/1e/85695f047749b1c03d91a0d8c19a4f9cabeb5a17423e1e4740865cd30345/dramatiq_azure-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-01 10:04:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bidossessi",
"github_project": "dramatiq-azure",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dramatiq_azure"
}