Class: Karafka::Responders::Topic
- Inherits:
-
Object
- Object
- Karafka::Responders::Topic
- Defined in:
- lib/karafka/responders/topic.rb
Overview
Topic describes a single topic on which we want to respond with responding requirements
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Name of the topic on which we want to respond.
Instance Method Summary collapse
-
#initialize(name, options) ⇒ Karafka::Responders::Topic
constructor
Topic description object.
-
#multiple_usage? ⇒ Boolean
Do we expect to use it multiple times in a single respond flow.
-
#required? ⇒ Boolean
Is this a required topic (if not, it is optional).
Constructor Details
#initialize(name, options) ⇒ Karafka::Responders::Topic
Returns topic description object.
17 18 19 20 21 |
# File 'lib/karafka/responders/topic.rb', line 17 def initialize(name, ) @name = name.to_s @options = validate! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Name of the topic on which we want to respond
12 13 14 |
# File 'lib/karafka/responders/topic.rb', line 12 def name @name end |
Instance Method Details
#multiple_usage? ⇒ Boolean
Returns do we expect to use it multiple times in a single respond flow.
29 30 31 |
# File 'lib/karafka/responders/topic.rb', line 29 def multiple_usage? @options[:multiple_usage] || false end |
#required? ⇒ Boolean
Returns is this a required topic (if not, it is optional).
24 25 26 |
# File 'lib/karafka/responders/topic.rb', line 24 def required? @options.key?(:required) ? @options[:required] : true end |