From c63468a704869dd60e231383c8206895245c0add Mon Sep 17 00:00:00 2001 From: uwer Date: Wed, 3 May 2023 16:22:37 +1000 Subject: [PATCH] disabled AMQP queue and binding for type topic --- internal/endpoint/amqp.go | 43 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/internal/endpoint/amqp.go b/internal/endpoint/amqp.go index b69a22ef..084f1884 100644 --- a/internal/endpoint/amqp.go +++ b/internal/endpoint/amqp.go @@ -93,28 +93,29 @@ func (conn *AMQPConn) Send(msg string) error { ); err != nil { return err } + if conn.ep.AMQP.Type != "topic" { + // Create queue if queue don't exists + if _, err := channel.QueueDeclare( + conn.ep.AMQP.QueueName, + conn.ep.AMQP.Durable, + conn.ep.AMQP.AutoDelete, + false, + conn.ep.AMQP.NoWait, + nil, + ); err != nil { + return err + } - // Create queue if queue don't exists - if _, err := channel.QueueDeclare( - conn.ep.AMQP.QueueName, - conn.ep.AMQP.Durable, - conn.ep.AMQP.AutoDelete, - false, - conn.ep.AMQP.NoWait, - nil, - ); err != nil { - return err - } - - // Binding exchange to queue - if err := channel.QueueBind( - conn.ep.AMQP.QueueName, - conn.ep.AMQP.RouteKey, - conn.ep.AMQP.QueueName, - conn.ep.AMQP.NoWait, - nil, - ); err != nil { - return err + // Binding exchange to queue + if err := channel.QueueBind( + conn.ep.AMQP.QueueName, + conn.ep.AMQP.RouteKey, + conn.ep.AMQP.QueueName, + conn.ep.AMQP.NoWait, + nil, + ); err != nil { + return err + } } conn.conn = c