parent
ac8c471dc0
commit
dd8b7e4d11
12
client.go
12
client.go
|
@ -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!")
|
||||
|
||||
|
|
Loading…
Reference in New Issue