Skip to main content

RabbitMq plugin for Pynenc distributed task management system

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.0.tar.gz (11.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.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynenc_rabbitmq-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.13

File hashes

Hashes for pynenc_rabbitmq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e69ac61f991924c877a93f84808c361d8341578c8514eec72ec4bce29c65ac09
MD5 587a4f11213d0d3cb97fd2ef3ba7a9a1
BLAKE2b-256 77fb7b6c3a1be58d3494119a9cbdf5d98b8ccec1697f054602c3b488fdc1d9ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pynenc_rabbitmq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 240d7ee824fc7cefdd9f4c2dace21cf5c7a56cea6771786ccefc163f2c41a03c
MD5 21302766cd8915c64cdf13ecc8aaf8a5
BLAKE2b-256 5cd91902a9cdc6670de0bf22b7a5b39b428b87e46bb116221c710b0ff0d866f6

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