Class: Karafka::Web::Pro::Commanding::Matchers::Topic
- Defined in:
- lib/karafka/web/pro/commanding/matchers/topic.rb
Overview
Matcher that checks if the current process has any assignments for the topic specified in the message matchers. Uses the Karafka assignments tracker to check actual current assignments rather than just routing configuration. This is an optional matcher that only applies when topic is specified.
Instance Method Summary collapse
-
#apply? ⇒ Boolean
True if topic criterion is specified in matchers.
-
#matches? ⇒ Boolean
Checks if this process has any partitions assigned for the specified topic.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Karafka::Web::Pro::Commanding::Matchers::Base
Instance Method Details
#apply? ⇒ Boolean
Returns true if topic criterion is specified in matchers.
42 43 44 |
# File 'lib/karafka/web/pro/commanding/matchers/topic.rb', line 42 def apply? !topic_name.nil? end |
#matches? ⇒ Boolean
Checks if this process has any partitions assigned for the specified topic
49 50 51 52 53 |
# File 'lib/karafka/web/pro/commanding/matchers/topic.rb', line 49 def matches? ::Karafka::App.assignments.any? do |topic, _partitions| topic.name == topic_name end end |