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) }