Class: Karafka::Cli::Server
Overview
Server Karafka Cli action
Constant Summary collapse
- OPTIONS_BUILDER =
Those options can also be used when in swarm mode, hence we re-use
lambda do option( :consumer_groups, 'Runs server only with specified consumer groups', Array, %w[ -g --consumer_groups --include_consumer_groups ] ) option( :subscription_groups, 'Runs server only with specified subscription groups', Array, %w[ --subscription_groups --include_subscription_groups ] ) option( :topics, 'Runs server only with specified topics', Array, %w[ --topics --include_topics ] ) option( :exclude_consumer_groups, 'Runs server without specified consumer groups', Array, %w[ --exclude_consumer_groups ] ) option( :exclude_subscription_groups, 'Runs server without specified subscription groups', Array, %w[ --exclude_subscription_groups ] ) option( :exclude_topics, 'Runs server without specified topics', Array, %w[ --exclude_topics ] ) end
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call ⇒ Object
Start the Karafka server.
-
#register_exclusions ⇒ Object
Registers things we want to exclude (if defined).
-
#register_inclusions ⇒ Object
Registers things we want to include (if defined).
Methods inherited from Base
aliases, commands, desc, #initialize, load, name, names, option, parse_options
Methods included from Helpers::Colorize
Constructor Details
This class inherits a constructor from Karafka::Cli::Base
Instance Method Details
#call ⇒ Object
Start the Karafka server
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/karafka/cli/server.rb', line 85 def call # Print our banner and info in the dev mode print_marketing_info if Karafka::App.env.development? register_inclusions register_exclusions Karafka::Server.execution_mode = :standalone Karafka::Server.run end |
#register_exclusions ⇒ Object
Registers things we want to exclude (if defined)
106 107 108 109 110 111 112 |
# File 'lib/karafka/cli/server.rb', line 106 def register_exclusions activity_manager.class::SUPPORTED_TYPES.each do |type| names = [:"exclude_#{type}"] || [] names.each { |name| activity_manager.exclude(type, name) } end end |
#register_inclusions ⇒ Object
Registers things we want to include (if defined)
97 98 99 100 101 102 103 |
# File 'lib/karafka/cli/server.rb', line 97 def register_inclusions SUPPORTED_TYPES.each do |type| names = [type] || [] names.each { |name| activity_manager.include(type, name) } end end |