Skip to content

Commit 296822b

Browse files
Sebastian Wagnerwaldbauer-certat
authored andcommitted
BUG: fix amqp collector and output parameter handling
exchange_name was incorrectly handled
1 parent 14d1b0c commit 296822b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

intelmq/bots/outputs/amqptopic/output.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ def init(self):
5555
else:
5656
self.publish_raises_nack = True
5757

58-
self._exchange = self.exchange_name
59-
self.durable = self.exchange_durable
6058
if self.username is not None and self.password is not None:
6159
self.kwargs['credentials'] = pika.PlainCredentials(self.username,
6260
self.password)
@@ -93,11 +91,11 @@ def connect_server(self):
9391
else:
9492
self.logger.info('AMQP connection successful.')
9593
self.channel = self._connection.channel()
96-
if self._exchange: # do not declare default exchange (#1295)
94+
if self.exchange_name: # do not declare default exchange (#1295)
9795
try:
98-
self.channel.exchange_declare(exchange=self._exchange,
96+
self.channel.exchange_declare(exchange=self.exchange_name,
9997
exchange_type=self.exchange_type,
100-
durable=self.durable)
98+
durable=self.exchange_durable)
10199
except pika.exceptions.ChannelClosed:
102100
self.logger.error('Access to exchange refused.')
103101
raise
@@ -121,7 +119,7 @@ def process(self):
121119
routing_key = self.routing_key
122120

123121
try:
124-
if not self.channel.basic_publish(exchange=self._exchange,
122+
if not self.channel.basic_publish(exchange=self.exchange_name,
125123
routing_key=routing_key,
126124
body=body,
127125
properties=self.properties,

0 commit comments

Comments
 (0)