Skip to content

Commit 3f0335d

Browse files
committed
AMQP: Respect MSGFLO_BROKER url
Would previously always connect to default localhost..
1 parent 33481ef commit 3f0335d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

msgflo/msgflo.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,14 @@ class AmqpEngine(Engine):
106106
def __init__(self, broker, discovery_period=None):
107107
Engine.__init__(self, broker, discovery_period=discovery_period)
108108

109-
# Connect to AMQP broker with default connection and authentication
110-
# FIXME: respect self.broker_url
111-
self._conn = haigha_Connection(transport='gevent',
112-
close_cb=self._connection_closed_cb,
109+
# Prepare connection to AMQP broker
110+
vhost = self.broker_info.path or '/'
111+
host = self.broker_info.hostname or 'localhost'
112+
port = self.broker_info.port or 5672
113+
user = self.broker_info.username or 'guest'
114+
password = self.broker_info.password or 'guest'
115+
self._conn = haigha_Connection(transport='gevent', close_cb=self._connection_closed_cb,
116+
host=host, vhost=vhost, port=port, user=user, password=password,
113117
logger=logger)
114118

115119
# Create message channel

0 commit comments

Comments
 (0)