HotQueue is a Python library that allows you to use Redis as a FIFO message queue within your Python programs. Using HotQueue looks a little bit like this…

Establishing a queue:

>>> queue = HotQueue("myqueue")

Putting messages onto the queue:

>>> queue.put("my message")
>>> queue.put({'name': "Richard Henry", 'eyes': "blue"})

Getting messages off the queue:

>>> queue.get()
"my message"
>>> queue.get()
{'name': 'Richard Henry', 'eyes': 'blue'}

Iterating over a queue indefinitely, waiting if nothing is available:

>>> for item in queue.consume():
...     print item

More advanced features that make it easy to work with queues are available. To go deeper, you should read the HotQueue Tutorial.

The main advantage of the HotQueue model is that there is no queue server to run, other than Redis. This is particularly ideal if you’re already using Redis as a datastore elsewhere. Plus, Redis is really fast!


To install it, run:

pip install -U hotqueue

It also works with easy_install, if that’s your jam. You can download versioned packages directly from PyPI.

The source code is available on GitHub.

To get help with HotQueue, use the HotQueue Users mailing list.


Table Of Contents

Related Topics

This Page