Skip to main content

RabbitMQ plugin for pynenc, a distributed task queue for Python.

Project description

Pynenc RabbitMq Plugin

CI codecov PyPI version Python versions

RabbitMq state backend plugin for Pynenc, providing distributed task state management using RabbitMq as the storage backend.

Features

  • 🚀 High Performance: Optimized RabbitMq operations with connection pooling
  • 🔒 Distributed Locking: RabbitMq-based distributed locks for task coordination
  • 🎯 Type Safe: Full type hints and mypy compatibility
  • 🧪 Well Tested: Comprehensive test suite with multiple RabbitMq versions
  • 📊 Production Ready: Battle-tested configuration options and monitoring

Quick Start

Installation

pip install pynenc-rabbitmq

Basic Usage

from pynenc import Pynenc
from pynenc_rabbitmq import RabbitMqStateBackend

# Create Pynenc app with RabbitMq backend
app = Pynenc().with_state_backend(
    RabbitMqStateBackend.from_uri("rabbitmq://localhost:27017/pynenc")
)

@app.task
def my_task(x: int, y: int) -> int:
    return x + y

# Use your tasks as normal
result = my_task(1, 2)

Configuration

Connection Configuration

from pynenc_rabbitmq import RabbitMqStateBackend, ConfigRabbitMq

config = ConfigRabbitMq(
    uri="rabbitmq://localhost:27017",
    database_name="my_pynenc_db",
    max_pool_size=100,
    write_concern_w="majority",
    read_preference="primaryPreferred"
)

backend = RabbitMqStateBackend(config)

Environment Variables

You can also configure via environment variables:

export PYNENC_RABBITMQ_URI="rabbitmq://localhost:27017"
export PYNENC_RABBITMQ_DATABASE="pynenc"
export PYNENC_RABBITMQ_MAX_POOL_SIZE="100"

Documentation

Development

Setup

  1. Clone the repository
  2. Install dependencies: poetry install --with dev
  3. Start RABBITMQ: docker-compose -f docker/docker-compose.yml up -d
  4. Run tests: poetry run pytest

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

pynenc_rabbitmq-0.1.6.tar.gz (417.1 kB view details)

Uploaded Source

Built Distribution

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

pynenc_rabbitmq-0.1.6-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file pynenc_rabbitmq-0.1.6.tar.gz.

File metadata

  • Download URL: pynenc_rabbitmq-0.1.6.tar.gz
  • Upload date:
  • Size: 417.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pynenc_rabbitmq-0.1.6.tar.gz
Algorithm Hash digest
SHA256 868e7640893a0ba5af7bcef30e60d88bd6b8d007ca971e11f015a07b81d950bd
MD5 56ecdad56b8de89ee9e5ebbaaa596eff
BLAKE2b-256 eaadd6ad6799d1fd076625ec7974d07eddd42cd142300a06d99bf4443ae8035f

See more details on using hashes here.

File details

Details for the file pynenc_rabbitmq-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pynenc_rabbitmq-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pynenc_rabbitmq-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 98b354b47d0a77f61823a2cfd38593cd789ab3ca3e3a642e6687bc1c615f5482
MD5 e9dc5bcd63207bd0050f33c0e2baa676
BLAKE2b-256 f5a61fe9b1bc0dfa431b7e68119537324273a69212e0a70f4d9954e0fcf036eb

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