maolin.liu commited on
Commit
854bf8d
·
1 Parent(s): a829e96

[bugfix]Check rabbitmq connection before send message.

Browse files
Files changed (1) hide show
  1. consumer/base.py +1 -0
consumer/base.py CHANGED
@@ -162,6 +162,7 @@ class BasicMessageSender(BasicPikaClient):
162
  properties = pika.BasicProperties(delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE,
163
  priority=headers.priority.value if headers else None,
164
  headers=headers.model_dump() if headers else None)
 
165
  self.channel.basic_publish(
166
  exchange=exchange_name,
167
  routing_key=routing_key,
 
162
  properties = pika.BasicProperties(delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE,
163
  priority=headers.priority.value if headers else None,
164
  headers=headers.model_dump() if headers else None)
165
+ self.check_connection()
166
  self.channel.basic_publish(
167
  exchange=exchange_name,
168
  routing_key=routing_key,