From faf6e7b2dd5efeb652f7c45c97b3831f026d6932 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 7 Dec 2023 18:48:10 +0300 Subject: [PATCH] feat(broker/rabbitmq): added support passing exchange type when declaring durable exchange --- v4/broker/rabbitmq/channel.go | 16 ++++++++-------- v4/broker/rabbitmq/connection.go | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/v4/broker/rabbitmq/channel.go b/v4/broker/rabbitmq/channel.go index 844a8324..4484ff57 100644 --- a/v4/broker/rabbitmq/channel.go +++ b/v4/broker/rabbitmq/channel.go @@ -107,15 +107,15 @@ func (r *rabbitMQChannel) DeclareExchange(ex Exchange) error { ) } -func (r *rabbitMQChannel) DeclareDurableExchange(exchange string) error { +func (r *rabbitMQChannel) DeclareDurableExchange(ex Exchange) error { return r.channel.ExchangeDeclare( - exchange, // name - "topic", // kind - true, // durable - false, // autoDelete - false, // internal - false, // noWait - nil, // args + ex.Name, // name + string(ex.Type), // kind + true, // durable + false, // autoDelete + false, // internal + false, // noWait + nil, // args ) } diff --git a/v4/broker/rabbitmq/connection.go b/v4/broker/rabbitmq/connection.go index b5a64bd1..8fb7444e 100644 --- a/v4/broker/rabbitmq/connection.go +++ b/v4/broker/rabbitmq/connection.go @@ -252,7 +252,7 @@ func (r *rabbitMQConn) tryConnect(secure bool, config *amqp.Config) error { if !r.withoutExchange { if r.exchange.Durable { - r.Channel.DeclareDurableExchange(r.exchange.Name) + r.Channel.DeclareDurableExchange(r.exchange) } else { r.Channel.DeclareExchange(r.exchange) }