added enabled to exchange and queue settings

alpha v1.0.24
alex 2023-01-08 21:03:25 +01:00
parent ac8c471dc0
commit dd8b7e4d11
1 changed files with 7 additions and 5 deletions

View File

@ -44,6 +44,7 @@ var ChannelQosSettingsDefault = ChannelQosSettings{
}
type ExchangeSettings struct {
Enabled bool
Name string
Type string
Durable bool
@ -61,6 +62,7 @@ type ExchangePublishSettings struct {
}
type QueueSettings struct {
Enabled bool
Name string
Durable bool
DeleteWhenUnused bool
@ -244,7 +246,7 @@ func (client *Client) init(conn *amqp.Connection) error {
return err
}
if client.exchangeSettings.Name != "" {
if client.exchangeSettings.Enabled {
err = ch.ExchangeDeclare(
client.exchangeSettings.Name,
client.exchangeSettings.Type,
@ -258,9 +260,9 @@ func (client *Client) init(conn *amqp.Connection) error {
if err != nil {
return err
}
}
client.changeChannel(ch)
} else {
if client.queueSettings.Enabled {
q, err := ch.QueueDeclare(
client.queueSettings.Name,
client.queueSettings.Durable,
@ -295,10 +297,10 @@ func (client *Client) init(conn *amqp.Connection) error {
}
client.AssignedQueueName = q.Name
client.changeChannel(ch)
}
client.changeChannel(ch)
client.isReady = true
client.logger.Debugln("Setup!")