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



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/karafka/cli/flow.rb', line 9

def call
  routes.each do |route|
    any_topics = !route.responder&.topics.nil?

    if any_topics
      puts "#{route.topic} =>"

      route.responder.topics.each do |_name, topic|
        features = []
        features << (topic.required? ? 'always' : 'conditionally')
        features << (topic.multiple_usage? ? 'one or more' : 'exactly once')

        print topic.name, "(#{features.join(', ')})"
      end
    else
      puts "#{route.topic} => (nothing)"
    end
  end
end