File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ type Client struct {
3636 bo Backoffer
3737 attempt int32
3838 l sync.Mutex
39+ config amqp.Config
3940}
4041
4142// Declare used to declare queues/exchanges/bindings.
@@ -118,7 +119,12 @@ func (c *Client) Loop() bool {
118119 atomic .AddInt32 (& c .attempt , 1 )
119120 }
120121
121- conn , err = amqp .Dial (c .addr )
122+ // set default Heartbeat to 10 seconds like in original amqp.Dial
123+ if c .config .Heartbeat == 0 {
124+ c .config .Heartbeat = 10 * time .Second
125+ }
126+
127+ conn , err = amqp .DialConfig (c .addr , c .config )
122128
123129 if c .reportErr (err ) {
124130 return true
@@ -265,3 +271,10 @@ func BlockingChan(blockingChan chan amqp.Blocking) ClientOpt {
265271 c .blocking = blockingChan
266272 }
267273}
274+
275+ // Config is a functional option, used to setup extended amqp configuration
276+ func Config (config amqp.Config ) ClientOpt {
277+ return func (c * Client ) {
278+ c .config = config
279+ }
280+ }
You can’t perform that action at this time.
0 commit comments