Pika connect to multiple exchanges within a single ioloop
===

I am trying to get Pika to allow me to connect to multiple RabbitMQ instances/exchanges.

I have done this previously with Tornado which is easy, I just wrote a custom PikaClient class (like in the Tornado example) and bind it multiple times to Tornado's ioloop using add_timeout().

I want to do a similar thing but without the use of Tornado.

I have written a PikaClient class for this, much like the Tornado example mention above, but I am having issues trying to create an ioloop within Pika that allows me to do this.

The problem is with me not being sure about how to actually spawn an ioloop using pika.IOLoop properly, it seems to require data being passed to it that comes from BaseConnection or SelectConnection (depending on where those vars are set).

I want to create an ioloop and then use the add_timeout() method (this does exist within pika.IOLoop) to connect to multiple servers.

Does anyone have any experience of this?

So far I am trying this but to no avail

        app = {}
        queues = queue_mapper.get_queues()
        connection = pika.IOLoop()
        for name, details in queues.iteritems():
            app[name] = PikaClient(details['exchange'], details['host'], details['port'],
                                   details['user'], details['pass'], details['vhost'])
            connection.add_timeout(.1, app[name].connect())
        connection.start()

I get the following stacktrace

    Traceback (most recent call last):
      File "/home/kura/.virtualenvs/hawkeye/bin/hawkeye", line 7, in <module>
        execfile(__file__)
      File "/home/kura/workspace/hawkeye/hawkeye/bin/hawkeye", line 194, in <module>
        connection.add_timeout(.1, app[name].connect())
      File "/home/kura/.virtualenvs/hawkeye/local/lib/python2.7/sitepackages/pika/adapters/select_connection.py", line 74, in add_timeout
        return self.poller.add_timeout(deadline, handler)
    AttributeError: 'IOLoop' object has no attribute 'poller'