Class: Karafka::Cli::Topics::Create
- Defined in:
- lib/karafka/cli/topics/create.rb
Overview
Creates topics based on the routing setup and configuration
Instance Method Summary collapse
-
#call ⇒ Boolean
True if any topic was created, otherwise false.
Methods included from Helpers::Colorize
Instance Method Details
#call ⇒ Boolean
Returns true if any topic was created, otherwise false.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/karafka/cli/topics/create.rb', line 9 def call any_created = false declaratives_routing_topics.each do |topic| name = topic.name if existing_topics_names.include?(name) puts "#{yellow('Skipping')} because topic #{name} already exists." else puts "Creating topic #{name}..." Admin.create_topic( name, topic.declaratives.partitions, topic.declaratives.replication_factor, topic.declaratives.details ) puts "#{green('Created')} topic #{name}." any_created = true end end any_created end |