Class: Karafka::Web::Ui::Models::Status::Checks::RoutingTopicsPresence
- Defined in:
- lib/karafka/web/ui/models/status/checks/routing_topics_presence.rb
Overview
Note:
This is a warning-only check - missing topics don’t block the dependency chain but should be addressed.
Checks if all active topics in the routing exist in the cluster.
This identifies topics that are configured in the routing but don’t actually exist in Kafka. Pattern-based topics are excluded from this check since they may not exist yet.
Class Method Summary collapse
-
.halted_details ⇒ Array
Empty array for halted state.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the routing topics presence check.
Methods inherited from Base
depends_on, independent!, independent?, #initialize
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Models::Status::Checks::Base
Class Method Details
.halted_details ⇒ Array
Returns empty array for halted state.
22 23 24 |
# File 'lib/karafka/web/ui/models/status/checks/routing_topics_presence.rb', line 22 def halted_details [] end |
Instance Method Details
#call ⇒ Status::Step
Executes the routing topics presence check.
Compares routed topics against existing cluster topics.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/karafka/web/ui/models/status/checks/routing_topics_presence.rb', line 32 def call existing = context.cluster_info.topics.map { |topic| topic[:topic_name] } missing = ::Karafka::App .routes .flat_map(&:topics) .flat_map { |topics| topics.map(&:itself) } .select(&:active?) .reject { |topic| topic.respond_to?(:patterns?) ? topic.patterns? : nil } .map(&:name) .uniq .then { |routed_topics| routed_topics - existing } step(missing.empty? ? :success : :warning, missing) end |