• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 14 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AMQP Python client

Haigha - Synchronous and asynchronous AMQP client library

https://travis-ci.org/agoragames/haigha.svg?branch=master
Version:0.9.0
Download:http://pypi.python.org/pypi/haigha
Source:https://github.com/agoragames/haigha
Keywords:python, amqp, rabbitmq, event, libevent, gevent

Overview

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.

Starting with the 0.5.0 series, haigha natively supports 3 transport types; libevent, gevent and standard sockets. The socket implementation defaults to synchronous mode and is useful for an interactive console or scripting, and the gevent transport is the preferred asynchronous backend though it can also be used synchronously as well.

Documentation

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

Example

See the scripts and examples directories 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

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

ch = connection.channel()
ch.exchange.declare('test_exchange', 'direct')
ch.queue.declare('test_queue', auto_delete=True)
ch.queue.bind('test_queue', 'test_exchange', 'test_key')
ch.basic.publish( Message('body', application_headers={'hello':'world'}),
  'test_exchange', 'test_key' )
print ch.basic.get('test_queue')
connection.close()

To use protocol extensions for RabbitMQ, initialize the connection with the haigha.connections.rabbit_connection.RabbitConnection class.

Roadmap

  • Documentation (there's always more)
  • Improved error handling
  • Implementation of error codes in the spec
  • Testing and integration with brokers other than RabbitMQ
  • Identify and improve inefficient code
  • Edge cases in frame management
  • Improvements to usabililty
  • SSL
  • Allow nowait when asynchronous transport but Connection put into synchronous mode.

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.

Installation

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
    

Note that haigha does not install either gevent or libevent support automatically. For libevent, haigha has been tested and deployed with the event-agora==0.4.1 library.

Testing

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 https://github.com/agoragames/haigha/issues

License

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

More Repositories

1

leaderboard

Leaderboards backed by Redis in Ruby
Ruby
478
star
2

kairos

Python module for time series data in Redis and Mongo
Python
207
star
3

stache

mustache and handlebars template handling in Rails 3.x and Rails 4.x
Ruby
166
star
4

leaderboard-python

Leaderboards backed by Redis in Python
Python
156
star
5

nginx-google-oauth

Lua module to add Google OAuth to nginx
Lua
141
star
6

activity_feed

Activity feeds backed by Redis
Ruby
135
star
7

amico

Relationships (e.g. friendships) backed by Redis
Ruby
112
star
8

confirm-with-reveal

Replacement for window.confirm() using the Reveal modal popup plugin from ZURB Foundation.
CoffeeScript
50
star
9

bracket_tree

Tree-based Bracketing System
Ruby
49
star
10

tassadar

A Starcraft 2 replay parser written in pure Ruby
Ruby
44
star
11

torus

A service implementing the Carbon protocol and storing time series data using kairos
Python
42
star
12

chai

Mocking framework for Python
Python
40
star
13

oembedr

Lightweight, Flexible OEmbed Consumer Library
Ruby
37
star
14

php-leaderboard

Leaderboards backed by Redis in PHP
PHP
25
star
15

leaderboard-coffeescript

Leaderboards backed by Redis in CoffeeScript
CoffeeScript
24
star
16

java-leaderboard

Leaderboards backed by Redis in Java
Java
24
star
17

factory-worker

Factories for NodeJS
JavaScript
23
star
18

bnet_scraper

A Nokogiri-based scraper of Battle.net profiles. Currently this only includes Starcraft2.
Ruby
22
star
19

python-leaderboard

Leaderboards backed by Redis in Python
Python
21
star
20

halo-reach-api

Ruby gem for interacting with the Halo:Reach API
Ruby
15
star
21

soonatra

Sinatra application to show a β€œComing Soon” page and collect emails.
Ruby
14
star
22

GWFSelect-for-jQuery-UI

Google WebFont selection drop-down widget for jQuery UI.
JavaScript
13
star
23

amico-python

Relationships (e.g. friendships) backed by Redis
Python
11
star
24

php-bracket_tree

Tree-based Bracketing System
PHP
10
star
25

strumbar

Strumbar is a wrapper around ActiveSupport::Notifications with preconfigurations for basic instrumentation to be sent to statsd.
Ruby
9
star
26

scala-leaderboard

Leaderboards backed by Redis in Scala
Scala
7
star
27

vindicia-api

A wrapper for creating queries to the Vindicia CashBox API
Ruby
7
star
28

windbag

Notification System for Rails 3.1+
Ruby
6
star
29

pyevent

Python extension module for Niels Provos' libevent
Python
6
star
30

node-amico

NodeJS port of amico (Relationships (e.g. friendships) backed by Redis) using CoffeeScript.
CoffeeScript
6
star
31

ventilation

Ruby
6
star
32

improved_logging

Adds improved logging capabilities to the ActiveSupport::BufferedLogger class
Ruby
5
star
33

bracketeer

BracketTree Visual Template Creator
Ruby
4
star
34

seed_list

Seed management for tournament brackets
Ruby
3
star
35

tassadar-server

A web service interface to the tassadar Starcraft 2 replay parser
Ruby
3
star
36

leaderboard_factory

Nice little package to help you with leaderboards when you need a lot of them.
Ruby
3
star
37

py-eventsocket

Python
3
star
38

notify-campfire-multi

Notify multiple campfire rooms from a post-commit svn hook
Ruby
2
star
39

silver_spoon

Entitlements in Redis
Ruby
2
star
40

mm_sortable_item

A tiny MongoMapper plugin to provide some basic list functionality.
Ruby
2
star
41

javascripto

Client-side Javascript Application Framework
Ruby
2
star
42

saltstack-sandbox

A Vagrant-based sandbox environment for experimenting with SaltStack
2
star
43

hydra-async-demo

This is a user facing tutorial that will help guide users through the usage of Hydra Studio to support an asynchronous multiplayer game.
C#
2
star
44

read-and-write-if-nil

Pass through the value of a block to a cache key if the value is nil when it's requested
Ruby
1
star
45

ruby-openid-oauth-hybrid

ruby-openid-2.1.2 with added support for the openid-oauth hybrid extention
Ruby
1
star
46

bcms_xml_data_feed

JavaScript
1
star
47

website-middleman

Company public site and blog, rendered to static files by Middleman.
SCSS
1
star
48

gondola

Ruby
1
star
49

seedlings

Simple seed data management
Ruby
1
star
50

bcms_twitter

Twitter integration for BrowserCMS
JavaScript
1
star
51

beta

Beta access restriction library
Ruby
1
star
52

test-runner-benchmark

Benchmarking your tests
Ruby
1
star
53

action-mailer-with-temporary-delivery-method

Send email using ActionMailer but without using the templates or changing your smtp_settings
Ruby
1
star