Skip to main content

🦅 Dramatiq Header Middleware for RabbitMQ

🛠 Installation

pip install dramatiq-header

⬆️ Upgrade version

pip install dramatiq-header --upgrade

✏️ Usage

Worker code:

import dramatiq
from dramatiq.brokers.rabbitmq import RabbitmqBroker
from dramatiq_header import HeadersMessage # Import Middleware


rabbitmq_broker = RabbitmqBroker()
dramatiq.set_broker(rabbitmq_broker)


rabbitmq_broker.add_middleware(HeadersMessage()) # Add Middleware


@dramatiq.actor(queue_name='example')
def my_task(message):
    print(f'Message Received: {message}')
    print(HeadersMessage.get_headers()) # Get headers
rabbitmq_broker.add_middleware(HeadersMessage('x-test-header'))

Sender example

import dramatiq
from dramatiq import Message
from dramatiq.brokers.rabbitmq import RabbitmqBroker


rabbitmq_broker = RabbitmqBroker()
dramatiq.set_broker(rabbitmq_broker)


def send_message(msg: str):
    message = Message(
        queue_name='example',
        actor_name='my_task',
        args=(msg, ),
        kwargs={},
        options={'x-test-header': 'test-header'}, # Send your entire header here
    )
    rabbitmq_broker.enqueue(message)


if __name__ == '__main__':
    send_message('test message')

Output

image


Metadata

Release files for dramatiq-header 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dramatiq-header 0.1.2
File Size Uploaded Provenance Actions
dramatiq_header-0.1.2.tar.gz 3.1 kB Without provenance Details for dramatiq_header-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dramatiq-header 0.1.2
File Interpreter ABI Platform Actions
dramatiq_header-0.1.2-py3-none-any.whl Python 3 none any Details for dramatiq_header-0.1.2-py3-none-any.whl

Total release size: 6.5 kB

Release files / dramatiq_header-0.1.2.tar.gz

Download URL dramatiq_header-0.1.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
babe9b6ba526f4f85c4666680d85287106b7fd07d127f9699869f38867f52bbe
BLAKE2b-256 checksum
How to use checksums
6b571f35495e4f1a1828c99ff03470d5fbf4dd69f36a4cd73691d0bcbb75bbef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Release files / dramatiq_header-0.1.2-py3-none-any.whl

Download URL dramatiq_header-0.1.2-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93c783d3fa69dc92f78192f8fdf8aed9d824890b4b08288e4ddf15bb5bfeb7a2
BLAKE2b-256 checksum
How to use checksums
9631bce276734999b7de09c3d3d97bb2815188dd717ccf9ecb74bfc99f09963c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Security for dramatiq-header 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page