Class: Karafka::Cli::Swarm

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

Overview

Starts swarm of consumers forked from the supervisor

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

aliases, commands, desc, #initialize, load, name, names, option, parse_options

Methods included from Helpers::Colorize

#green, #grey, #red, #yellow

Constructor Details

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

Instance Method Details

#callObject

Starts the swarm



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/karafka/cli/swarm.rb', line 15

def call
  ::Karafka::Swarm.ensure_supported!

  # Print our banner and info in the dev mode
  print_marketing_info if Karafka::App.env.development?

  # This will register inclusions and exclusions in the routing, so all forks will use it
  server = Server.new
  server.register_inclusions
  server.register_exclusions

  Karafka::Server.execution_mode = :supervisor
  Karafka::Swarm::Supervisor.new.run
end