Module: Karafka::Pro::Routing::Features::Patterns::Topic
- Defined in:
- lib/karafka/pro/routing/features/patterns/topic.rb
Overview
Patterns feature topic extensions
Instance Method Summary collapse
- #patterns(active: false, type: :regular, pattern: nil) ⇒ Object
-
#patterns? ⇒ Boolean
Is this topic a member of patterns.
-
#subscription_name ⇒ String
Subscription name or the regexp string representing matching of new topics that should be detected.
-
#to_h ⇒ Hash
Topic with all its native configuration options plus patterns.
Instance Method Details
#patterns(active: false, type: :regular, pattern: nil) ⇒ Object
22 23 24 |
# File 'lib/karafka/pro/routing/features/patterns/topic.rb', line 22 def patterns(active: false, type: :regular, pattern: nil) @patterns ||= Config.new(active: active, type: type, pattern: pattern) end |
#patterns? ⇒ Boolean
Returns is this topic a member of patterns.
27 28 29 |
# File 'lib/karafka/pro/routing/features/patterns/topic.rb', line 27 def patterns? patterns.active? end |
#subscription_name ⇒ String
Returns subscription name or the regexp string representing matching of new topics that should be detected.
15 16 17 |
# File 'lib/karafka/pro/routing/features/patterns/topic.rb', line 15 def subscription_name patterns.active? && patterns.matcher? ? patterns.pattern.regexp_string : super end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus patterns.
32 33 34 35 36 |
# File 'lib/karafka/pro/routing/features/patterns/topic.rb', line 32 def to_h super.merge( patterns: patterns.to_h ).freeze end |