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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/karafka/web/pro/ui/controllers/routing_controller.rb', line 44

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



76
77
78
79
80
81
82
83
84
# File 'lib/karafka/web/pro/ui/controllers/routing_controller.rb', line 76

def show(topic_id)
  detect_patterns_routes

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

  @topic || not_found!(topic_id)

  render
end