Class: Karafka::Web::Pro::Ui::Controllers::RoutingController

Inherits:
BaseController show all
Defined in:
lib/karafka/web/pro/ui/controllers/routing_controller.rb

Overview

Routing details - same as in OSS

Constant Summary

Constants inherited from Ui::Controllers::BaseController

Ui::Controllers::BaseController::Models

Instance Attribute Summary

Attributes inherited from Ui::Controllers::BaseController

#params, #session

Instance Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#cache, #initialize

Methods included from Ui::Controllers::Requests::Hookable

included, #run_after_hooks, #run_before_hooks

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController

Instance Method Details

#indexObject

Routing list



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/karafka/web/pro/ui/controllers/routing_controller.rb', line 19

def index
  detect_patterns_routes

  @routes = Karafka::App.routes
  @routes.each do |consumer_group|
    refine(consumer_group.topics)
  end

  current_state = Models::ConsumersState.current
  @assigned = Hash.new { |h, k| h[k] = Set.new }

  # If there are active processes, we can use their data to mark certain topics as
  # assigned. This does not cover the full scope as some partitions may be assigned
  # and some not, but provides general overview
  if current_state
    Models::Processes.active(current_state).each do |process|
      process.consumer_groups.each do |consumer_group|
        consumer_group.subscription_groups.each do |subscription_group|
          subscription_group.topics.each do |topic|
            @assigned[consumer_group.id.to_s] << topic.name
          end
        end
      end
    end
  end

  render
end

#show(topic_id) ⇒ Object

Given route details

Parameters:

  • topic_id (String)

    topic id



51
52
53
54
55
56
57
58
59
# File 'lib/karafka/web/pro/ui/controllers/routing_controller.rb', line 51

def show(topic_id)
  detect_patterns_routes

  @topic = Karafka::Routing::Router.find_by(id: topic_id)

  @topic || not_found!(topic_id)

  render
end