diff options
Diffstat (limited to 'plugins/jobs/brokers')
-rw-r--r-- | plugins/jobs/brokers/amqp/config.go | 22 | ||||
-rw-r--r-- | plugins/jobs/brokers/amqp/plugin.go | 1 |
2 files changed, 23 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 +} diff --git a/plugins/jobs/brokers/amqp/plugin.go b/plugins/jobs/brokers/amqp/plugin.go new file mode 100644 index 00000000..0e8d02ac --- /dev/null +++ b/plugins/jobs/brokers/amqp/plugin.go @@ -0,0 +1 @@ +package amqp |