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.4.tar.gz (145.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.4-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynenc_rabbitmq-0.1.4.tar.gz
  • Upload date:
  • Size: 145.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for pynenc_rabbitmq-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6554c71d4906adc7fc466bdbc243690a17677330718f6a0d25144ce4d428dec1
MD5 51d8e2ee8439eab1af8b0387c46f2474
BLAKE2b-256 ab09783296f2899e0e1f6966d86e97f4d369ee8703cbade2042f38229a445436

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynenc_rabbitmq-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f70b25094d6da774f3cbe7d8f75246cb64cf51f897867e35eefd6d77bfdae9c8
MD5 8500b2f4a0daafbc2906c2aa206bb818
BLAKE2b-256 8319f0842827ccb3935c9ea993316965cd1ad55d247baf9bb2ba466384878e9e

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