[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/spumer/dramatiq-kombu-broker)
# dramatiq-kombu-broker
Dramatiq Kombu-based broker
## Key features:
- Connection pool support (native): no unexpected connections count grow up!
- Channel pool support (via [kombu-pyamqp-threadsafe](https://github.com/spumer/kombu-pyamqp-threadsafe) lib): consume and produce through channels, "Connection limit reach" fixed now!
### Minor features
- Auto-add hostname to connection props.
- Allow change default queue name without changing each actor (e.g. 'default' -> 'dramatiq')
- Consumer healthcheck support
- Ignore topology difference (PreconditionFailed), you can change your queue options safely
- No scary Pika logs. Fully based on kombu.
- ACK/NACK in YOUR middleware. Check message acknowledge status: Message.acknowledged
### Auto-add hostname to connection props. Now you can see location of each connection in RabbitMQ web admin
![](./media/connection_hostname.png)
## Installing
To install this package, run:
```sh
pip install dramatiq-kombu-broker
```
## Using
### Django Dramatiq
**settings.py**
```python
DRAMATIQ_BROKER = {
'BROKER': 'dramatiq_kombu_broker.broker.ConnectionSharedKombuBroker',
'OPTIONS': {
'kombu_connection_options': KOMBU_RABBITMQ_PARAMS,
},
}
```
## Contributing
<details>
<summary>Prerequisites</summary>
<details>
<summary>1. Set up Git to use SSH</summary>
1. [Generate an SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) and [add the SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
1. Configure SSH to automatically load your SSH keys:
```sh
cat << EOF >> ~/.ssh/config
Host *
AddKeysToAgent yes
IgnoreUnknown UseKeychain
UseKeychain yes
ForwardAgent yes
EOF
```
</details>
<details>
<summary>2. Install Docker</summary>
1. [Install Docker Desktop](https://www.docker.com/get-started).
- _Linux only_:
- Export your user's user id and group id so that [files created in the Dev Container are owned by your user](https://github.com/moby/moby/issues/3206):
```sh
cat << EOF >> ~/.bashrc
export UID=$(id --user)
export GID=$(id --group)
EOF
```
</details>
<details>
<summary>3. Install VS Code or PyCharm</summary>
1. [Install VS Code](https://code.visualstudio.com/) and [VS Code's Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Alternatively, install [PyCharm](https://www.jetbrains.com/pycharm/download/).
2. _Optional:_ install a [Nerd Font](https://www.nerdfonts.com/font-downloads) such as [FiraCode Nerd Font](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode) and [configure VS Code](https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions) or [configure PyCharm](https://github.com/tonsky/FiraCode/wiki/Intellij-products-instructions) to use it.
</details>
</details>
<details open>
<summary>Development environments</summary>
The following development environments are supported:
1. ⭐️ _GitHub Codespaces_: click on _Code_ and select _Create codespace_ to start a Dev Container with [GitHub Codespaces](https://github.com/features/codespaces).
1. ⭐️ _Dev Container (with container volume)_: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/spumer/dramatiq-kombu-broker) to clone this repository in a container volume and create a Dev Container with VS Code.
1. _Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/⌘</kbd> + <kbd>⇧</kbd> + <kbd>P</kbd> → _Dev Containers: Reopen in Container_.
1. _PyCharm_: clone this repository, open it with PyCharm, and [configure Docker Compose as a remote interpreter](https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#docker-compose-remote) with the `dev` service.
1. _Terminal_: clone this repository, open it with your terminal, and run `docker compose up --detach dev` to start a Dev Container in the background, and then run `docker compose exec dev zsh` to open a shell prompt in the Dev Container.
</details>
<details>
<summary>Developing</summary>
- This project follows the [Conventional Commits](https://www.conventionalcommits.org/) standard to automate [Semantic Versioning](https://semver.org/) and [Keep A Changelog](https://keepachangelog.com/) with [Commitizen](https://github.com/commitizen-tools/commitizen).
- Run `poe` from within the development environment to print a list of [Poe the Poet](https://github.com/nat-n/poethepoet) tasks available to run on this project.
- Run `poetry add {package}` from within the development environment to install a run time dependency and add it to `pyproject.toml` and `poetry.lock`. Add `--group test` or `--group dev` to install a CI or development dependency, respectively.
- Run `poetry update` from within the development environment to upgrade all dependencies to the latest versions allowed by `pyproject.toml`.
- Run `cz bump` to bump the package's version, update the `CHANGELOG.md`, and create a git tag.
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/spumer/dramatiq-kombu-broker",
"name": "dramatiq-kombu-broker",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "spumer",
"author_email": "spumer-tm@yandex.ru> <spumer-tm@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/a1/83/71b67e4b87be12268fe79c3a8793c6506bcc4453cef1d90c438a47eafef5/dramatiq_kombu_broker-0.2.2.tar.gz",
"platform": null,
"description": "[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/spumer/dramatiq-kombu-broker)\n\n# dramatiq-kombu-broker\n\nDramatiq Kombu-based broker\n\n\n## Key features:\n\n- Connection pool support (native): no unexpected connections count grow up!\n- Channel pool support (via [kombu-pyamqp-threadsafe](https://github.com/spumer/kombu-pyamqp-threadsafe) lib): consume and produce through channels, \"Connection limit reach\" fixed now!\n\n### Minor features\n\n- Auto-add hostname to connection props.\n- Allow change default queue name without changing each actor (e.g. 'default' -> 'dramatiq')\n- Consumer healthcheck support\n- Ignore topology difference (PreconditionFailed), you can change your queue options safely\n- No scary Pika logs. Fully based on kombu.\n- ACK/NACK in YOUR middleware. Check message acknowledge status: Message.acknowledged\n\n\n### Auto-add hostname to connection props. Now you can see location of each connection in RabbitMQ web admin\n![](./media/connection_hostname.png)\n\n## Installing\n\nTo install this package, run:\n\n```sh\npip install dramatiq-kombu-broker\n```\n\n## Using\n\n### Django Dramatiq\n\n**settings.py**\n\n```python\n DRAMATIQ_BROKER = {\n 'BROKER': 'dramatiq_kombu_broker.broker.ConnectionSharedKombuBroker',\n 'OPTIONS': {\n 'kombu_connection_options': KOMBU_RABBITMQ_PARAMS,\n },\n }\n```\n\n## Contributing\n\n<details>\n<summary>Prerequisites</summary>\n\n<details>\n<summary>1. Set up Git to use SSH</summary>\n\n1. [Generate an SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) and [add the SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\n1. Configure SSH to automatically load your SSH keys:\n ```sh\n cat << EOF >> ~/.ssh/config\n \n Host *\n AddKeysToAgent yes\n IgnoreUnknown UseKeychain\n UseKeychain yes\n ForwardAgent yes\n EOF\n ```\n\n</details>\n\n<details>\n<summary>2. Install Docker</summary>\n\n1. [Install Docker Desktop](https://www.docker.com/get-started).\n - _Linux only_:\n - Export your user's user id and group id so that [files created in the Dev Container are owned by your user](https://github.com/moby/moby/issues/3206):\n ```sh\n cat << EOF >> ~/.bashrc\n \n export UID=$(id --user)\n export GID=$(id --group)\n EOF\n ```\n\n</details>\n\n<details>\n<summary>3. Install VS Code or PyCharm</summary>\n\n1. [Install VS Code](https://code.visualstudio.com/) and [VS Code's Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Alternatively, install [PyCharm](https://www.jetbrains.com/pycharm/download/).\n2. _Optional:_ install a [Nerd Font](https://www.nerdfonts.com/font-downloads) such as [FiraCode Nerd Font](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode) and [configure VS Code](https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions) or [configure PyCharm](https://github.com/tonsky/FiraCode/wiki/Intellij-products-instructions) to use it.\n\n</details>\n\n</details>\n\n<details open>\n<summary>Development environments</summary>\n\nThe following development environments are supported:\n\n1. \u2b50\ufe0f _GitHub Codespaces_: click on _Code_ and select _Create codespace_ to start a Dev Container with [GitHub Codespaces](https://github.com/features/codespaces).\n1. \u2b50\ufe0f _Dev Container (with container volume)_: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/spumer/dramatiq-kombu-broker) to clone this repository in a container volume and create a Dev Container with VS Code.\n1. _Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/\u2318</kbd> + <kbd>\u21e7</kbd> + <kbd>P</kbd> \u2192 _Dev Containers: Reopen in Container_.\n1. _PyCharm_: clone this repository, open it with PyCharm, and [configure Docker Compose as a remote interpreter](https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#docker-compose-remote) with the `dev` service.\n1. _Terminal_: clone this repository, open it with your terminal, and run `docker compose up --detach dev` to start a Dev Container in the background, and then run `docker compose exec dev zsh` to open a shell prompt in the Dev Container.\n\n</details>\n\n<details>\n<summary>Developing</summary>\n\n- This project follows the [Conventional Commits](https://www.conventionalcommits.org/) standard to automate [Semantic Versioning](https://semver.org/) and [Keep A Changelog](https://keepachangelog.com/) with [Commitizen](https://github.com/commitizen-tools/commitizen).\n- Run `poe` from within the development environment to print a list of [Poe the Poet](https://github.com/nat-n/poethepoet) tasks available to run on this project.\n- Run `poetry add {package}` from within the development environment to install a run time dependency and add it to `pyproject.toml` and `poetry.lock`. Add `--group test` or `--group dev` to install a CI or development dependency, respectively.\n- Run `poetry update` from within the development environment to upgrade all dependencies to the latest versions allowed by `pyproject.toml`.\n- Run `cz bump` to bump the package's version, update the `CHANGELOG.md`, and create a git tag.\n\n</details>\n",
"bugtrack_url": null,
"license": null,
"summary": "Dramatiq Kombu-based broker",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/spumer/dramatiq-kombu-broker",
"Repository": "https://github.com/spumer/dramatiq-kombu-broker"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "100edfc10aef512254dde072d28befd2456c96e350c48f77cd25efd068a26655",
"md5": "7a3fd0f3a7c22999193e266c13a5d2c9",
"sha256": "8d3b12bfc38f966c20d7d439ed83b5f114d88b379a4728341118a7478d7816ff"
},
"downloads": -1,
"filename": "dramatiq_kombu_broker-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7a3fd0f3a7c22999193e266c13a5d2c9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 18532,
"upload_time": "2024-10-21T13:30:00",
"upload_time_iso_8601": "2024-10-21T13:30:00.311466Z",
"url": "https://files.pythonhosted.org/packages/10/0e/dfc10aef512254dde072d28befd2456c96e350c48f77cd25efd068a26655/dramatiq_kombu_broker-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a18371b67e4b87be12268fe79c3a8793c6506bcc4453cef1d90c438a47eafef5",
"md5": "6766c9099a23c74415b817ce1e0f2485",
"sha256": "bd29cb89e11eec8af348c52cc9b5ea64d3b23a972f704ea827540712192af7c5"
},
"downloads": -1,
"filename": "dramatiq_kombu_broker-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "6766c9099a23c74415b817ce1e0f2485",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 17671,
"upload_time": "2024-10-21T13:30:01",
"upload_time_iso_8601": "2024-10-21T13:30:01.469834Z",
"url": "https://files.pythonhosted.org/packages/a1/83/71b67e4b87be12268fe79c3a8793c6506bcc4453cef1d90c438a47eafef5/dramatiq_kombu_broker-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-21 13:30:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spumer",
"github_project": "dramatiq-kombu-broker",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dramatiq-kombu-broker"
}