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 Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#initialize

Constructor Details

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

Instance Method Details

#indexObject

Lists DLQ topics



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/karafka/web/pro/ui/controllers/dlq_controller.rb', line 22

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