summaryrefslogtreecommitdiff
path: root/plugins/jobs/brokers/amqp/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jobs/brokers/amqp/config.go')
-rw-r--r--plugins/jobs/brokers/amqp/config.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/jobs/brokers/amqp/config.go b/plugins/jobs/brokers/amqp/config.go
new file mode 100644
index 00000000..a60cb486
--- /dev/null
+++ b/plugins/jobs/brokers/amqp/config.go
@@ -0,0 +1,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
+}