Class: Karafka::Status
- Inherits:
-
Object
- Object
- Karafka::Status
- Defined in:
- lib/karafka/status.rb
Overview
App status monitor
Constant Summary collapse
- STATES =
Available states and their transitions.
{ initializing: :initialize!, initialized: :initialized!, running: :run!, # will no longer pickup any work, but current work will be finished quieting: :quiet!, # no work is happening but we keep process with the assignments running quiet: :quieted!, # shutdown started stopping: :stop!, # all things are done and most of the things except critical are closed stopped: :stopped!, # immediately after this process exists terminated: :terminate! }.freeze
Instance Method Summary collapse
-
#done? ⇒ Boolean
True if we are in any of the status that would indicate we should no longer process incoming data.
-
#initialize ⇒ Status
constructor
By default we are in the initializing state.
-
#reset! ⇒ Object
Resets the status state This is used mostly in the integration suite.
-
#to_s ⇒ String
Stringified current app status.
Constructor Details
#initialize ⇒ Status
By default we are in the initializing state
29 30 31 |
# File 'lib/karafka/status.rb', line 29 def initialize initialize! end |
Instance Method Details
#done? ⇒ Boolean
Returns true if we are in any of the status that would indicate we should no longer process incoming data. It is a meta status built from others and not a separate state in the sense of a state machine.
69 70 71 72 73 74 |
# File 'lib/karafka/status.rb', line 69 def done? # Short-track for the most common case not to invoke all others on normal execution return false if running? stopping? || stopped? || quieting? || quiet? || terminated? end |
#reset! ⇒ Object
Resets the status state This is used mostly in the integration suite
40 41 42 |
# File 'lib/karafka/status.rb', line 40 def reset! @status = :initializing end |
#to_s ⇒ String
Returns stringified current app status.
34 35 36 |
# File 'lib/karafka/status.rb', line 34 def to_s @status.to_s end |