Class: Karafka::Web::Management::Actions::DeleteTopics

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

Overview

Removes the Web-UI topics from Kafka

Instance Method Summary collapse

Instance Method Details

#callObject

Removes the Web-UI topics



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

def call
  [
    ::Karafka::Web.config.topics.consumers.states,
    ::Karafka::Web.config.topics.consumers.reports,
    ::Karafka::Web.config.topics.consumers.metrics,
    ::Karafka::Web.config.topics.consumers.commands,
    ::Karafka::Web.config.topics.errors
  ].each do |topic_name|
    if existing_topics_names.include?(topic_name.to_s)
      puts "Removing #{topic_name}..."
      ::Karafka::Admin.delete_topic(topic_name)
      puts "Topic #{topic_name} #{successfully} deleted."
    else
      puts "Topic #{topic_name} not found."
    end
  end
end