Class: Karafka::Web::Pro::Ui::Controllers::DlqController

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

Overview

DLQ topics overview

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

Lists DLQ topics



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/karafka/web/pro/ui/controllers/dlq_controller.rb', line 14

def index
  topics = Karafka::App.consumer_groups.flat_map(&:topics).flat_map(&:to_a)

  dlq_topic_patterns = topics
                       .map { |source_topic| source_topic.dead_letter_queue.topic }
                       .uniq
                       .compact
                       .select(&:itself)

  dlq_topic_patterns += Web.config.ui.dlq_patterns

  @dlq_topics = Models::ClusterInfo
                .topics
                .select { |topic| dlq?(dlq_topic_patterns, topic[:topic_name]) }
                .sort_by { |topic| topic[:topic_name] }

  render
end