Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Client struct {
bo Backoffer
attempt int32
l sync.Mutex
config amqp.Config
}

// Declare used to declare queues/exchanges/bindings.
Expand Down Expand Up @@ -118,7 +119,12 @@ func (c *Client) Loop() bool {
atomic.AddInt32(&c.attempt, 1)
}

conn, err = amqp.Dial(c.addr)
// set default Heartbeat to 10 seconds like in original amqp.Dial
if c.config.Heartbeat == 0 {
c.config.Heartbeat = 10 * time.Second
}

conn, err = amqp.DialConfig(c.addr, c.config)

if c.reportErr(err) {
return true
Expand Down Expand Up @@ -265,3 +271,10 @@ func BlockingChan(blockingChan chan amqp.Blocking) ClientOpt {
c.blocking = blockingChan
}
}

// Config is a functional option, used to setup extended amqp configuration
func Config(config amqp.Config) ClientOpt {
return func(c *Client) {
c.config = config
}
}