### Install from Source Source: https://github.com/celery/librabbitmq/blob/master/README.rst Installs librabbitmq from source by downloading, building, and installing the package. ```bash $ tar xvfz librabbitmq-0.0.0.tar.gz $ cd librabbitmq-0.0.0 $ python setup.py build # python setup.py install # as root ``` -------------------------------- ### Install Development Version Source: https://github.com/celery/librabbitmq/blob/master/README.rst Installs the development version of librabbitmq by cloning the repository and using make. ```bash $ git clone git://github.com/celery/librabbitmq.git $ cd librabbitmq $ make install # or make develop ``` -------------------------------- ### Install librabbitmq Source: https://github.com/celery/librabbitmq/blob/master/README.rst Installs the librabbitmq library using pip or easy_install. ```bash $ pip install librabbitmq ``` ```bash $ easy_install librabbitmq ``` -------------------------------- ### Install Test Requirements Source: https://github.com/celery/librabbitmq/blob/master/requirements/README.rst Installs the Python packages necessary to run the comprehensive unit test suite for the Celery librabbitmq project. ```bash pip install -U -r requirements/test.txt ``` -------------------------------- ### Install Default Requirements Source: https://github.com/celery/librabbitmq/blob/master/requirements/README.rst Installs the default set of Python packages required for the Celery librabbitmq project, typically for Python 2.7+ compatibility. ```bash pip install -U -r requirements/default.txt ``` -------------------------------- ### Stand-alone Connection and Channel Operations Source: https://github.com/celery/librabbitmq/blob/master/README.rst Demonstrates creating a standalone connection, channel, and performing basic AMQP operations like exchange declaration, queue declaration, and queue binding. ```python from librabbitmq import Connection conn = Connection(host="localhost", userid="guest", password="guest", virtual_host="/") channel = conn.channel() channel.exchange_declare(exchange, type, ...) channel.queue_declare(queue, ...) channel.queue_bind(queue, exchange, routing_key) ``` -------------------------------- ### Connect with Kombu Source: https://github.com/celery/librabbitmq/blob/master/README.rst Establishes a connection to RabbitMQ using librabbitmq via the Kombu library. ```python from kombu import Connection x = Connection("librabbitmq://") ``` -------------------------------- ### Producing Messages Source: https://github.com/celery/librabbitmq/blob/master/README.rst Publishes a message to an exchange with a specified routing key. ```python channel.basic_publish(body, exchange, routing_key, ...) ``` -------------------------------- ### Other Channel and Connection Operations Source: https://github.com/celery/librabbitmq/blob/master/README.rst Includes operations for unbinding queues, closing channels, and closing connections. ```python channel.queue_unbind(queue, ...) channel.close() connection.close() ``` -------------------------------- ### Consuming Messages Source: https://github.com/celery/librabbitmq/blob/master/README.rst Consumes messages from a queue, processes them with a callback function, and acknowledges them. ```python def dump_message(message): print("Body:'%s', Properties:'%s', DeliveryInfo:'%s'" % ( message.body, message.properties, message.delivery_info)) message.ack() channel.basic_consume(queue, ..., callback=dump_message) while True: connection.drain_events() ``` -------------------------------- ### Polling for Messages Source: https://github.com/celery/librabbitmq/blob/master/README.rst Retrieves a single message from a queue and processes it if available. ```python message = channel.basic_get(queue, ...) if message: dump_message(message) print("Body:'%s' Properties:'%s' DeliveryInfo:'%s'" % ( message.body, message.properties, message.delivery_info)) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.