Sha256: a9811573b6dac7634fce55bc643ef4bd78217d0183df1388a4de43ec60340825
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true module Karafka # Karafka framework Cli class Cli < Thor # Description of topics flow (incoming/outgoing) class Flow < Base desc 'Print application data flow (incoming => outgoing)' # Print out all defined routes in alphabetical order def call topics.each do |topic| any_topics = !topic.responder&.topics.nil? if any_topics puts "#{topic.name} =>" topic.responder.topics.each_value do |responder_topic| features = [] features << (responder_topic.required? ? 'always' : 'conditionally') print responder_topic.name, "(#{features.join(', ')})" end else puts "#{topic.name} => (nothing)" end end end private # @return [Array<Karafka::Routing::Topic>] all topics sorted in alphabetical order def topics Karafka::App.consumer_groups.map(&:topics).flatten.sort_by(&:name) end # Prints a given value with label in a nice way # @param label [String] label describing value # @param value [String] value that should be printed def print(label, value) printf( "%<label>-25s %<value>s\n", label: " - #{label}:", value: value ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
karafka-1.3.5 | lib/karafka/cli/flow.rb |
karafka-1.3.4 | lib/karafka/cli/flow.rb |