Skip to content
AMQP Python client
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Haigha - AMQP libevent Python client

Version: 0.4.5
Keywords:python, amqp, rabbitmq, event, libevent


Haigha provides a simple to use client library for interacting with AMQP brokers. It currently supports the 0.9.1 protocol and is integration tested against the latest RabbitMQ 2.8.1 (see errata). Haigha is a descendant of py-amqplib and owes much to its developers.

The goals of haigha are performance, simplicity, and adherence to the form and function of the AMQP protocol. It adds a few useful features, such as the ChannelPool class and Channel.publish_synchronous, to ease use of powerful features in real-world applications.

By default, Haigha operates in a completely asynchronous mode, relying on callbacks to notify application code of responses from the broker. Where applicable, nowait defaults to True. The application code is welcome to call a series of methods, and Haigha will manage the stack and synchronous handshakes in the event loop.


This file and the various files in the scripts directory serve as a simple introduction to haigha. For more complete documentation, see DOCUMENTATION.rst.


See the scripts directory for several examples, in particular the stress_test script which you can use to test the performance of haigha against your broker. Below is a simple example of a client that connects, processes one message and quits.

from haigha.connection import Connection
from haigha.message import Message
import event

connection = Connection(
  user='guest', password='guest',
  vhost='/', host='localhost',
  heartbeat=None, debug=True)

def consumer(msg):
  print msg
  event.timeout( 2, event.abort )

ch ='test_exchange', 'direct', auto_delete=True)
ch.queue.declare('test_queue', auto_delete=True)
ch.queue.bind('test_queue', 'test_exchange', 'test_key')
ch.basic.consume('test_queue', consumer)
ch.basic.publish( Message('body', application_headers={'hello':'world'}),
  'test_exchange', 'test_key' )



The 0.3.0 series will focus on the following areas:

  • Full unit test coverage
  • Implementation of error response codes according to spec
  • Add callback chains where they're missing
  • Documentation, including doctstrings, API docs, and tutorials
  • Bug fixes

By the 0.4.0 series the library should be feature-complete and well documented. We'll then switch our focus to libevent itself, with the goal of supporting gevent, libev and pypy.

Haigha has been tested exclusively with Python 2.6 and 2.7, but we intend for it to work with the 3.x series as well. Please report any issues you may have.


Haigha is available on pypi and can be installed using pip

pip install haigha

If installing from source:

  • with development requirements (e.g. testing frameworks)

    pip install -r development.txt
  • without development requirements

    pip install -r requirements.txt


Unit tests can be run with either the included script, or with nose

./haigha$ scripts/test
./haigha$ nosetests

There are two other testing scripts of note. rabbit_table_test is a simple integration test that confirms compliance with RabbitMQ errata. The stress_test script is a valuable tool that offers load-testing capability similar to Apache Bench or Siege. It is used both to confirm the robustness of haigha, as well as benchmark hardware or a broker configuration.

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to our issue tracker at


This software is licensed under the New BSD License. See the LICENSE.txt file in the top distribution directory for the full license text.

Something went wrong with that request. Please try again.