Class: RubyKafkaRetryValidator
- Inherits:
-
Object
- Object
- RubyKafkaRetryValidator
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby_kafka_retry_validator.rb
Instance Attribute Summary collapse
-
#dlq_topic ⇒ Object
Returns the value of attribute dlq_topic.
-
#message ⇒ Object
Returns the value of attribute message.
-
#original_topic ⇒ Object
Returns the value of attribute original_topic.
-
#retry_topic ⇒ Object
Returns the value of attribute retry_topic.
Instance Method Summary collapse
-
#initialize(retry_topic, dlq_topic, message) ⇒ RubyKafkaRetryValidator
constructor
A new instance of RubyKafkaRetryValidator.
- #validate ⇒ Object
- #validate_dlq_topic ⇒ Object
- #validate_message ⇒ Object
- #validate_retry_topic ⇒ Object
Constructor Details
#initialize(retry_topic, dlq_topic, message) ⇒ RubyKafkaRetryValidator
Returns a new instance of RubyKafkaRetryValidator.
10 11 12 13 14 |
# File 'lib/ruby_kafka_retry_validator.rb', line 10 def initialize(retry_topic, dlq_topic, ) @retry_topic = retry_topic @dlq_topic = dlq_topic @message = end |
Instance Attribute Details
#dlq_topic ⇒ Object
Returns the value of attribute dlq_topic.
4 5 6 |
# File 'lib/ruby_kafka_retry_validator.rb', line 4 def dlq_topic @dlq_topic end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/ruby_kafka_retry_validator.rb', line 4 def @message end |
#original_topic ⇒ Object
Returns the value of attribute original_topic.
4 5 6 |
# File 'lib/ruby_kafka_retry_validator.rb', line 4 def original_topic @original_topic end |
#retry_topic ⇒ Object
Returns the value of attribute retry_topic.
4 5 6 |
# File 'lib/ruby_kafka_retry_validator.rb', line 4 def retry_topic @retry_topic end |
Instance Method Details
#validate ⇒ Object
16 17 18 19 20 |
# File 'lib/ruby_kafka_retry_validator.rb', line 16 def validate validate_retry_topic validate_dlq_topic end |
#validate_dlq_topic ⇒ Object
26 27 28 |
# File 'lib/ruby_kafka_retry_validator.rb', line 26 def validate_dlq_topic raise "Validation failed: DLQ topic shouldn't be blank" unless dlq_topic.present? end |
#validate_message ⇒ Object
30 31 32 |
# File 'lib/ruby_kafka_retry_validator.rb', line 30 def raise "Validation failed: Topic message must be a non-empty Hash" unless(.present? && .is_a?(Hash)) end |
#validate_retry_topic ⇒ Object
22 23 24 |
# File 'lib/ruby_kafka_retry_validator.rb', line 22 def validate_retry_topic raise "Validation failed: Retry topic shouldn't be blank" unless retry_topic.present? end |