Sha256: 8dd578522954fe622c01f560433dc525f6a058bd98ae21ef033c51bf61339fef
Contents?: true
Size: 816 Bytes
Versions: 23
Compression:
Stored size: 816 Bytes
Contents
# frozen_string_literal: true module Karafka # App status monitor class Status # Available states and their transitions. STATES = { initializing: :initialize!, initialized: :initialized!, running: :run!, stopping: :stop!, stopped: :stopped! }.freeze private_constant :STATES # By default we are in the initializing state def initialize initialize! end STATES.each do |state, transition| define_method :"#{state}?" do @status == state end define_method transition do @status = state # Skip on creation (initializing) # We skip as during this state we do not have yet a monitor return if initializing? Karafka.monitor.instrument("app.#{state}") end end end end
Version data entries
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
karafka-2.0.0.beta5 | lib/karafka/status.rb |
karafka-2.0.0.beta4 | lib/karafka/status.rb |
karafka-2.0.0.beta3 | lib/karafka/status.rb |