mirror of
https://github.com/jimeh/amqp-failover.git
synced 2026-02-19 10:56:44 +00:00
added :primary_config failover option
This commit is contained in:
@@ -22,6 +22,7 @@ module AMQP
|
||||
def initialize(confs = nil, opts = {})
|
||||
@configs = Failover::Configurations.new(confs)
|
||||
@options = default_options.merge(opts)
|
||||
@configs.primary_ref = @options[:primary_config]
|
||||
end
|
||||
|
||||
class << self
|
||||
@@ -33,9 +34,10 @@ module AMQP
|
||||
end
|
||||
|
||||
def default_options
|
||||
{ :retry_timeout => 1,
|
||||
:selection => :sequential, #TODO: Impliment next server selection algorithm
|
||||
:fallback => false, #TODO: Enable by default once a sane implimentation is figured out
|
||||
{ :primary_config => 0,
|
||||
:retry_timeout => 1,
|
||||
:selection => :sequential, #TODO: Implement next server selection algorithm
|
||||
:fallback => false, #TODO: Enable by default once a sane implementation is figured out
|
||||
:fallback_interval => 10 }
|
||||
end
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ module AMQP
|
||||
#
|
||||
# Available failover options are:
|
||||
# - :retry_timeout, time to wait before retrying a specific AMQP config after failure.
|
||||
# - :primary_config, specify which of the supplied configurations is it the primary one. The default
|
||||
# value is 0, the first item in the config array. Use 1 for the second and so on.
|
||||
# - :fallback, check for the return of the primary server, and fallback to it if and when it returns.
|
||||
# - :fallback_interval, seconds between each check for original server if :fallback is true.
|
||||
# - :selection, not yet implimented.
|
||||
|
||||
Reference in New Issue
Block a user