Class: Karafka::Web::Ui::Models::Status::Checks::StateCalculation
- Defined in:
- lib/karafka/web/ui/models/status/checks/state_calculation.rb
Overview
Checks if there is a subscription to the reports topic being actively consumed.
The Web UI requires an active consumer processing the reports topic to calculate and update the state. This check verifies that subscription exists.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the state calculation check.
Methods inherited from Base
depends_on, halted_details, independent!, independent?, #initialize
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Models::Status::Checks::Base
Instance Method Details
#call ⇒ Status::Step
Executes the state calculation check.
Looks for the reports topic in the list of subscribed topics from the health data. Caches subscriptions in context.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/karafka/web/ui/models/status/checks/state_calculation.rb', line 23 def call context.subscriptions ||= Models::Health .current(context.current_state) .values.map { |consumer_group| consumer_group[:topics] } .flat_map(&:keys) subscribed = context.subscriptions.include?(context.topics_consumers_reports) step(subscribed ? :success : :failure) end |