summaryrefslogtreecommitdiff
path: root/plugins/jobs/brokers/amqp/config.go
blob: a60cb48643da393afed4ca78edcc5cae0ff6b772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package amqp

import "time"

// Config defines sqs broker configuration.
type Config struct {
	// Addr of AMQP server (example: amqp://guest:guest@localhost:5672/).
	Addr string

	// Timeout to allocate the connection. Default 10 seconds.
	Timeout int
}

// TimeoutDuration returns number of seconds allowed to redial
func (c *Config) TimeoutDuration() time.Duration {
	timeout := c.Timeout
	if timeout == 0 {
		timeout = 10
	}

	return time.Duration(timeout) * time.Second
}