Class: Karafka::Web::Management::Actions::Enable

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/management/actions/enable.rb

Overview

Note:

This runs on each process start that has karafka.rb. It needs to be executed also in the context of other processes types and not only karafka server, because it installs producers instrumentation and routing as well.

Instance Method Summary collapse

Instance Method Details

#callObject

Enables routing consumer group and subscribes Web-UI listeners



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/karafka/web/management/actions/enable.rb', line 12

def call
  ensure_karafka_initialized!

  # Prevent double enabling
  return if ::Karafka::Web.config.enabled

  ::Karafka::Web.config.enabled = true

  extend_routing
  setup_tracking_activity

  # Do not subscribe monitors or do anything else if tracking is disabled
  return unless ::Karafka::Web.config.tracking.active

  subscribe_to_monitor
  subscribe_to_close_web_producer
end