Commit b9ccd763 authored by jssuzanne's avatar jssuzanne
Browse files

Fixed publish

--HG--
branch : 8.0
parent 3c482fec5406
......@@ -74,27 +74,22 @@ class AnyBusProfile(models.Model):
_connection = pika.BlockingConnection(parameters)
channel = _connection.channel()
channel.confirm_delivery()
if channel.basic_publish(
channel.basic_publish(
exchange=exchange,
routing_key=routing_key,
body=data,
properties=pika.BasicProperties(
content_type=contenttype,
delivery_mode=1)
):
logger.info("Message published %r", self)
# if for obscure raison the message can be deleted
# then the message that dont break all
else:
raise Exception("Can publish message")
)
logger.info("Message published %r", self)
finally:
if channel and not channel.is_closed and not channel.is_closing:
if channel and not channel.is_closed:
channel.close()
if (
_connection and
not _connection.is_closed and
not _connection.is_closing
not _connection.is_closed
):
_connection.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment