Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 69 lines (49 sloc) 1.96 KB



AMQP/WebSocket handler for Tornado web server. The purpose of Hermodur is to forward messages from an AMQP server to a client connected to the Tornado server via a server. The main benefits of this are two:

  • Only one connection is opened to the AMQP server (a single instance of RabbitMQ supports rougly 800)
  • Since the listener is a server it enables older browsers that do not have WebSocket implemented to connect.


There are two ways to install hermodur onto your system

# old school - setup tools

# new way - using pip
pip install

How to use

In order to load the HermodurConnection into the Tornado ioloop it has to be configured and the connection the AMQP server has to be initiated. Below is a small example

from tornado import web

from tornadio2 import TornadioRouter, SocketServer
from hermodur import HermodurConnection

class SocketIOHandler(web.RequestHandler):
    def get(self):

# We use the defaults localhost:5672 and guest:guest on vhost '/'

# Use the routes classmethod to build the correct resource
HermodurRouter = TornadioRouter(HermodurConnection)

# configure the Tornado application
application = web.Application(
    socket_io_port = 8001

if __name__ == '__main__':
    import logging

    # Create and start tornadio server

The client then connects using a client and a connection method supported by the client's browser. When the connection to the server is established the client simply send a JSON message containing the desired exchange and routing_key.

{ "exchange": "my_exchange", "routing_key": "my_routing_key" }

A more detailed example will be added soon ...