Skip to content

Commit

Permalink
feat(broker/rabbitmq): added support passing exchange type when decla…
Browse files Browse the repository at this point in the history
…ring durable exchange
  • Loading branch information
r3eg authored Dec 7, 2023
1 parent 185a524 commit faf6e7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions v4/broker/rabbitmq/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down
2 changes: 1 addition & 1 deletion v4/broker/rabbitmq/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit faf6e7b

Please sign in to comment.