Skip to main content

WeenSpace RabbitMQ client for AMQP 1.0 - Event-driven microservices communication with OAuth2, TLS, Dead Letter Queues, and Priority Queues support

Project description

WeenSpace RabbitMQ Client

PyPI version Python 3.13+ License

A powerful Python RabbitMQ client for AMQP 1.0 protocol, designed for event-driven microservices architecture.

✨ Features

  • 🔐 Authentication: OAuth2, TLS/SSL, Basic Auth
  • 📬 Queue Types: Classic, Quorum, Stream queues
  • ☠️ Dead Letter Queues: Built-in DLQ support with configurable strategies
  • Priority Queues: Native priority queue support
  • 🔄 Auto Reconnection: Configurable recovery with exponential backoff
  • 🔀 All Exchange Types: Direct, Fanout, Topic, Headers
  • 🚀 Async Support: Native asyncio integration
  • 📊 Streams: RabbitMQ Streams with filtering support

📦 Installation

pip install weenspace-rabbitmq

🚀 Quick Start

Basic Publisher/Consumer

from weenspace_rabbitmq import (
    Environment,
    Connection,
    Publisher,
    Consumer,
    Message,
    ClassicQueueSpecification,
    ExchangeSpecification,
)

# Create environment and connection
environment = Environment(uri="amqp://guest:guest@localhost:5672/")
connection = environment.connection()

# Declare queue with dead letter support
management = connection.management()
queue_spec = ClassicQueueSpecification(
    name="my-queue",
    is_durable=True,
    dead_letter_exchange="dlx",
    dead_letter_routing_key="dlx-key",
    max_priority=10,  # Enable priority
)
management.declare_queue(queue_spec)

# Publish message
publisher = connection.publisher("/queues/my-queue")
publisher.publish(Message(body=b"Hello WeenSpace!"))

# Consume messages
def on_message(message):
    print(f"Received: {message.body}")
    message.accept()

consumer = connection.consumer("/queues/my-queue", handler=on_message)

Async Support

import asyncio
from weenspace_rabbitmq.asyncio import AsyncEnvironment

async def main():
    async with AsyncEnvironment(uri="amqp://localhost:5672/") as env:
        async with env.connection() as conn:
            publisher = await conn.publisher("/queues/my-queue")
            await publisher.publish(Message(body=b"Async message!"))

asyncio.run(main())

OAuth2 Authentication

from weenspace_rabbitmq import Environment, OAuth2Options

oauth = OAuth2Options(token="your_jwt_token")
environment = Environment(
    uri="amqp://localhost:5672/",
    oauth2_options=oauth
)

TLS/SSL Connection

from weenspace_rabbitmq import Environment, SslConfiguration

ssl_config = SslConfiguration(
    ca_cert="/path/to/ca.pem",
    client_cert="/path/to/client.pem",
    client_key="/path/to/client.key"
)
environment = Environment(
    uri="amqps://localhost:5671/",
    ssl_configuration=ssl_config
)

📚 Documentation

See examples folder for more detailed usage examples.

🔄 Migration from python-rabbitmq

# Old (python-rabbitmq)
# from python_rabbitmq import RabbitMQ

# New (weenspace-rabbitmq)
from weenspace_rabbitmq import Environment, Connection

📋 Requirements

  • Python 3.13+
  • RabbitMQ 4.x with AMQP 1.0 plugin enabled

📄 License

MIT License - Based on the official RabbitMQ AMQP Python Client

🙏 Credits

This library is based on the official RabbitMQ AMQP 1.0 Python client by the RabbitMQ team.

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

weenspace_rabbitmq-0.1.0.tar.gz (111.1 kB view details)

Uploaded Source

Built Distribution

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

weenspace_rabbitmq-0.1.0-py3-none-any.whl (138.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: weenspace_rabbitmq-0.1.0.tar.gz
  • Upload date:
  • Size: 111.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/25.2.0

File hashes

Hashes for weenspace_rabbitmq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ab7d7dd824cf046a719d28999128e7d4ddf20b34baff46f1dd7c237a047ec13
MD5 9a5cbb0da31d67e61fa368ffeb92b786
BLAKE2b-256 b1fffef911b4109bf0bd9274e9efa11d68838838b10027ba65db41e7c9895682

See more details on using hashes here.

File details

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

File metadata

  • Download URL: weenspace_rabbitmq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 138.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/25.2.0

File hashes

Hashes for weenspace_rabbitmq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e683b9b999d0aa6454c013592def4f40c16b1455cf447548f32c5297d34f67
MD5 c529cb2291d105623ade9eeb28a8bdc3
BLAKE2b-256 5ec76170a2d193736a96938976fc37db01220ad13732494ff0c450bcb8946b8e

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