Skip to main content

RabbitMQ-subprocess-client

RabbitMQ-subprocess-client is a RabbitMq client (based on pika) spawning tasks as subprocess, allowing handling segfault gracefully.

Install

pip install rabbitmq-subprocess-client

usage

import os
from concurrent.futures import TimeoutError
import traceback
from rabbitmq_subprocess_client import Runner, Consumer

class MyConsumer(Consumer):
    def consume_main(self, basic_deliver, msg):
        print(f'pre-processing message: {msg} in process: {os.getpid()}')
        try:
            args = []
            kwargs = {}
            self.exec(msg, *args, **kwargs)  # This will run the consume_subprocess method in a subprocess
            self.acknowledge_message(basic_deliver.delivery_tag)
        except TimeoutError:
            self.nacknowledge_message(basic_deliver.delivery_tag)
        except BaseException:
            exc_msg = traceback.format_exc()
            print(exc_msg)
            self.nacknowledge_message(basic_deliver.delivery_tag)

    @staticmethod
    def consume_subprocess(msg, *args, **kwargs):
        print(f'processing message: {msg} in process: {os.getpid()}')

worker = Runner(
    'my_queue', 
    MyConsumer, 
    host="127.0.0.1",
    port="5672",
    user="guest",
    password="guest",
    timeout=None,
)
worker.run()

develop

poetry shell
poetry install
pytest
pre-commit install

Publish new version

poetry publish --build --username= --password=

Metadata

Release files for rabbitmq-subprocess-client 1.0.1

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

Source distribution (sdist)

Source distribution for rabbitmq-subprocess-client 1.0.1
File Size Uploaded Provenance Actions
rabbitmq_subprocess_client-1.0.1.tar.gz 5.9 kB Without provenance Details for rabbitmq_subprocess_client-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rabbitmq-subprocess-client 1.0.1
File Interpreter ABI Platform Actions
rabbitmq_subprocess_client-1.0.1-py3-none-any.whl Python 3 none any Details for rabbitmq_subprocess_client-1.0.1-py3-none-any.whl

Total release size: 13.1 kB

Release files / rabbitmq_subprocess_client-1.0.1.tar.gz

Download URL rabbitmq_subprocess_client-1.0.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
71abcba552cb720d77a0e80d634e51a8ad42cafcda7482b3cfabe54b44a27f91
BLAKE2b-256 checksum
How to use checksums
141d0f5660586f5d9afdf4581e19ca4464a889e12590b1dfeb429193a051d14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.10 Linux/6.2.8-arch1-1

Release files / rabbitmq_subprocess_client-1.0.1-py3-none-any.whl

Download URL rabbitmq_subprocess_client-1.0.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0256aebca4eefe3501f9ca553f04fba4e7d38dac5d257b88cca1dff8125e985
BLAKE2b-256 checksum
How to use checksums
31ee30aa4914635e8aca39cd74f75a6e9a322036e3d7891834db325f5b3427ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.10 Linux/6.2.8-arch1-1

Security for rabbitmq-subprocess-client 1.0.1

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