Class: Karafka::Cli::Flow

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/cli/flow.rb

Overview

Description of topics flow (incoming/outgoing)

Instance Attribute Summary

Attributes inherited from Base

#cli

Instance Method Summary collapse

Methods inherited from Base

bind_to, desc, #initialize, option

Constructor Details

This class inherits a constructor from Karafka::Cli::Base

Instance Method Details

#callObject

Print out all defined routes in alphabetical order



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/flow.rb', line 11

def call
  topics.each do |topic|
    any_topics = !topic.responder&.topics.nil?
    log_messages = []

    if any_topics
      log_messages << "#{topic.name} =>"

      topic.responder.topics.each_value do |responder_topic|
        features = []
        features << (responder_topic.required? ? 'always' : 'conditionally')

        log_messages << format(responder_topic.name, "(#{features.join(', ')})")
      end
    else
      log_messages << "#{topic.name} => (nothing)"
    end

    Karafka.logger.info(log_messages.join("\n"))
  end
end