4

I'm trying to connect to multiple RabbitMQ hosts using Kombu, however, unlike other examples that I've found, the goal is not to use multiple hosts as a fallback, I just want to be able to deal with the connections on the same thread.

I came across this example on the Kombu wiki using a connection pool, but it does not showcase how to consume from both connections simultaneously,

from kombu import Connection
from kombu.pools import connections

c1 = Connection('amqp://')
c2 = Connection('redis://')

with connections[c1].acquire(block=True) as conn1:
    with connections[c2].acquire(block=True) as conn2:
        # ....

What is the proper way to address this?

Gonçalo Cabrita
  • 353
  • 1
  • 5
  • 11

0 Answers0