Not Logged In

puka 0.0.7

Puka is yet-another Python client library for RabbitMQ. But as opposedto similar libraries, it does not try to expose a generic AMQPAPI. Instead, it takes an opinionated view on how the user shouldinteract with RabbitMQ.

Puka is simple--------------

Puka exposes a simple, easy to understand API. Take a look at the`publisher` example:

You can mix synchronous and asynchronous programming styles if you wantto.

Puka never blocks-----------------

In the pure asynchronous programming style Puka never blocks yourprogram waiting for network. However it is your responsibility tonotify when new data is available on the network socket. To allow thatPuka allows you to access the raw socket descriptor. With that in handyou can construct your own event loop. Here's an the event loop thatmay replace `wait_for_any` from previous example:

Puka is asynchronous and has no trouble in handling many requests at atime. This can be exploited to achieve a degree of parallelism. Forexample, this snippet creates 1000 queues in parallel:

promises = [client.queue_declare(queue='a%04i' % i) for i in range(1000)] for promise in promises: client.wait(promise)

Puka also has a nicely optimized AMQP codec, but don't expect miracles- it can't go faster than Python.

Puka is sensible----------------

Puka does expose only a sensible subset of AMQP, as judged by the author.

The major differences between Puka and normal AMQP libraries include:

- Puka doesn't expose AMQP channels to the users. - Puka treats `basic_publish` as a synchronous method. You can wait on it and make sure that your data is delivered. Alternatively, you may ignore the promise and treat it as an asynchronous command. - Puka tries to cope with the AMQP exceptions and expose them to the user in a predictable way. Unlike other libraries it's possible (and recommended!) to recover from AMQP errors.

Puka is experimental--------------------

Puka is a side project, written mostly to prove if it is possible tocreate a reasonable API on top of the AMQP protocol.

I like it! Show me more!------------------------

The best examples to start with are in the[rabbitmq-tutorials repo](https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/python-puka)

More code can be found in the `./examples` directory. Someinteresting bits:

- `./examples/send.py`: sends one message - `./examples/receive_one.py`: receives one message - `./examples/stress_amqp_consume.py`: a script used to benchmark the throughput of the server

There is also a bunch of fairly complicated examples hidden in thetests (see the `./tests` directory).

I want to install Puka----------------------

Puka works with Python 2.6 and 2.7.

You can install Puka system-wide using pip:

sudo pip install puka

Alternatively to install it in the `virtualenv` local environment:

virtualenv my_venv pip -E my_venv install puka

Or if you need the code from trunk:

sudo pip install -e git+http://github.com/majek/puka.git#egg=puka

I want to run the examples--------------------------

Great. Make sure you have `rabbitmq` server installed and follow thissteps:

git clone https://github.com/majek/puka.git cd puka make cd examples

Now you're ready to run the examples, start with:

python send.py

I want to see the API documentation-----------------------------------

The easiest way to get started is to take a look at the examples andtweak them to your needs. Detailed documentation doesn't existnow. If it existed it would live here: