Class: AwsSqsMoniter::Configuration::RedrivePolicyConfiguration
- Inherits:
-
Object
- Object
- AwsSqsMoniter::Configuration::RedrivePolicyConfiguration
- Includes:
- Validatable
- Defined in:
- lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb
Instance Attribute Summary collapse
-
#dead_letter_queue ⇒ Object
Returns the value of attribute dead_letter_queue.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#max_receive_count ⇒ Object
Returns the value of attribute max_receive_count.
Instance Method Summary collapse
- #copy_onto(redrive_policy) ⇒ Object
-
#initialize(owner) ⇒ RedrivePolicyConfiguration
constructor
A new instance of RedrivePolicyConfiguration.
- #validate ⇒ Object
Methods included from Validatable
Constructor Details
#initialize(owner) ⇒ RedrivePolicyConfiguration
Returns a new instance of RedrivePolicyConfiguration.
6 7 8 9 10 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 6 def initialize owner @owner = owner @enabled = true @max_receive_count = 10 end |
Instance Attribute Details
#dead_letter_queue ⇒ Object
Returns the value of attribute dead_letter_queue.
12 13 14 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 12 def dead_letter_queue @dead_letter_queue end |
#enabled ⇒ Object
Returns the value of attribute enabled.
12 13 14 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 12 def enabled @enabled end |
#max_receive_count ⇒ Object
Returns the value of attribute max_receive_count.
12 13 14 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 12 def max_receive_count @max_receive_count end |
Instance Method Details
#copy_onto(redrive_policy) ⇒ Object
26 27 28 29 30 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 26 def copy_onto redrive_policy redrive_policy.enabled = enabled redrive_policy.max_receive_count = max_receive_count redrive_policy.dead_letter_queue = dead_letter_queue end |
#validate ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/aws_sqs_moniter/configuration/redrive_policy_configuration.rb', line 16 def validate unless (1..1000).include? max_receive_count errors << "#{@owner.name}.redrive_policy.max_receive_count must be in the range 1..1000" end if enabled && dead_letter_queue.blank? errors << "#{@owner.name}.redrive_policy.dead_letter_queue is required" end end |