# 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
```
## Usage
### ASQBroker
The broker looks for `AZURE_STORAGE_CONNECTION_STR` in the environment, to authenticate on Azure Storage.
You need to make sure that the variable exists at runtime.
Creating a connection string for your Azure account is documented [here](https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string).
```python
import os
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)
```
## 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
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/81/2f/ca9bfe058a874f25ccec5910de8e426eb1880923b99a4dc88a0ecbd54f4f/dramatiq_azure-0.2.0.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```\n## Usage\n\n### ASQBroker\n\nThe broker looks for `AZURE_STORAGE_CONNECTION_STR` in the environment, to authenticate on Azure Storage.\nYou need to make sure that the variable exists at runtime.\n\nCreating a connection string for your Azure account is documented [here](https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string).\n\n\n```python\nimport os\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## 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\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Azure Queue Brokers for Dramatiq",
"version": "0.2.0",
"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": "59cd3ef1c1872a3bc3d7a2cf458324ef747238d0bb2b4297d0bdbceeb02846cb",
"md5": "346a5ebd60daec385b55b0c9e2daadba",
"sha256": "8fd4931f6835d14f273a07d39ba8828fc7565fb7238bda08d702c45e29e2e3c6"
},
"downloads": -1,
"filename": "dramatiq_azure-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "346a5ebd60daec385b55b0c9e2daadba",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 9316,
"upload_time": "2023-07-16T18:28:30",
"upload_time_iso_8601": "2023-07-16T18:28:30.242805Z",
"url": "https://files.pythonhosted.org/packages/59/cd/3ef1c1872a3bc3d7a2cf458324ef747238d0bb2b4297d0bdbceeb02846cb/dramatiq_azure-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "812fca9bfe058a874f25ccec5910de8e426eb1880923b99a4dc88a0ecbd54f4f",
"md5": "fdd477a34ab525455044d976cde8e91f",
"sha256": "1cc5f678bda5f4b41cc03a4ad10785fa04024f7280171c811462eb37eaf01657"
},
"downloads": -1,
"filename": "dramatiq_azure-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "fdd477a34ab525455044d976cde8e91f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 8675,
"upload_time": "2023-07-16T18:28:31",
"upload_time_iso_8601": "2023-07-16T18:28:31.558533Z",
"url": "https://files.pythonhosted.org/packages/81/2f/ca9bfe058a874f25ccec5910de8e426eb1880923b99a4dc88a0ecbd54f4f/dramatiq_azure-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-16 18:28:31",
"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"
}