Class: Karafka::Web::Ui::Models::Status::Checks::InitialConsumersState
- Defined in:
- lib/karafka/web/ui/models/status/checks/initial_consumers_state.rb
Overview
Checks if the initial consumers state is present and can be deserialized.
The consumers state topic must contain valid data that can be parsed. This check fetches the current state and attempts to deserialize it.
Class Method Summary collapse
-
.halted_details ⇒ Hash
Details indicating presence issue for halted state.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the initial consumers state 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 ⇒ Hash
Returns details indicating presence issue for halted state.
18 19 20 |
# File 'lib/karafka/web/ui/models/status/checks/initial_consumers_state.rb', line 18 def halted_details { issue_type: :presence } end |
Instance Method Details
#call ⇒ Status::Step
Executes the initial consumers state check.
Fetches the current consumers state from Kafka and verifies it can be deserialized. Caches the result in context for subsequent checks.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/karafka/web/ui/models/status/checks/initial_consumers_state.rb', line 29 def call details = { issue_type: :presence } begin context.current_state ||= Models::ConsumersState.current status = context.current_state ? :success : :failure rescue JSON::ParserError status = :failure details[:issue_type] = :deserialization end step(status, details) end |