Class: Karafka::Web::Pro::Commanding::Matchers::ConsumerGroupId
- Defined in:
- lib/karafka/web/pro/commanding/matchers/consumer_group_id.rb
Overview
Matcher that checks if the current process has any assignments for the consumer group ID 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 consumer_group_id is specified.
Instance Method Summary collapse
-
#apply? ⇒ Boolean
True if consumer_group_id criterion is specified in matchers.
-
#matches? ⇒ Boolean
Checks if this process has any assignments for the specified consumer group.
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 consumer_group_id criterion is specified in matchers.
42 43 44 |
# File 'lib/karafka/web/pro/commanding/matchers/consumer_group_id.rb', line 42 def apply? !consumer_group_id.nil? end |
#matches? ⇒ Boolean
Checks if this process has any assignments for the specified consumer group
49 50 51 52 53 |
# File 'lib/karafka/web/pro/commanding/matchers/consumer_group_id.rb', line 49 def matches? ::Karafka::App.assignments.any? do |topic, _partitions| topic.consumer_group.id == consumer_group_id end end |