Class: AwsSqsMoniter::Configuration::QueueConfiguration
- Inherits:
-
Object
- Object
- AwsSqsMoniter::Configuration::QueueConfiguration
- Includes:
- Validatable
- Defined in:
- lib/aws_sqs_moniter/configuration/queue_configuration.rb
Instance Attribute Summary collapse
-
#delay_seconds ⇒ Object
Returns the value of attribute delay_seconds.
-
#message_retention_period ⇒ Object
Returns the value of attribute message_retention_period.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#visibility_timeout ⇒ Object
Returns the value of attribute visibility_timeout.
Instance Method Summary collapse
- #copy_onto(queue) ⇒ Object
-
#initialize(name) ⇒ QueueConfiguration
constructor
A new instance of QueueConfiguration.
- #redrive_policy ⇒ Object
- #validate ⇒ Object
Methods included from Validatable
Constructor Details
#initialize(name) ⇒ QueueConfiguration
Returns a new instance of QueueConfiguration.
6 7 8 9 10 11 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 6 def initialize name @name = name @delay_seconds = 0 @message_retention_period = 1_209_600 @visibility_timeout = 30 end |
Instance Attribute Details
#delay_seconds ⇒ Object
Returns the value of attribute delay_seconds.
13 14 15 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 13 def delay_seconds @delay_seconds end |
#message_retention_period ⇒ Object
Returns the value of attribute message_retention_period.
13 14 15 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 13 def @message_retention_period end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 17 def name @name end |
#visibility_timeout ⇒ Object
Returns the value of attribute visibility_timeout.
13 14 15 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 13 def visibility_timeout @visibility_timeout end |
Instance Method Details
#copy_onto(queue) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 40 def copy_onto queue queue.delay_seconds = delay_seconds queue. = queue.visibility_timeout = visibility_timeout redrive_policy.copy_onto queue.redrive_policy if queue.respond_to? :redrive_policy end |
#redrive_policy ⇒ Object
19 20 21 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 19 def redrive_policy @redrive_policy ||= RedrivePolicyConfiguration.new self end |
#validate ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/aws_sqs_moniter/configuration/queue_configuration.rb', line 23 def validate unless (0..900).include? delay_seconds errors << "#{name}.delay_seconds must be in the range 0..900" end unless (60..1_209_600).include? errors << "#{name}.message_retention_period must be in the range 60..1209600" end unless (0..43_200).include? visibility_timeout errors << "#{name}.visibility_timeout must be in the range 0..43200" end redrive_policy.valid? errors.push *(redrive_policy.errors) end |