Sha256: 5926a645507e60c32ae1976e4b293ab3de4bcc70c2e36fca718452558a10d78f

Contents?: true

Size: 819 Bytes

Versions: 11

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module Karafka
  # Karafka framework Cli
  class Cli
    # Starts swarm of consumers forked from the supervisor
    class Swarm < Base
      desc 'Starts swarm of Karafka consumers with a supervisor'

      aliases :swarm

      instance_exec(&Server::OPTIONS_BUILDER)

      # Starts the swarm
      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
karafka-2.4.17 lib/karafka/cli/swarm.rb
karafka-2.4.16 lib/karafka/cli/swarm.rb
karafka-2.4.15 lib/karafka/cli/swarm.rb
karafka-2.4.14 lib/karafka/cli/swarm.rb
karafka-2.4.13 lib/karafka/cli/swarm.rb
karafka-2.4.12 lib/karafka/cli/swarm.rb
karafka-2.4.11 lib/karafka/cli/swarm.rb
karafka-2.4.10 lib/karafka/cli/swarm.rb
karafka-2.4.9 lib/karafka/cli/swarm.rb
karafka-2.4.8 lib/karafka/cli/swarm.rb
karafka-2.4.7 lib/karafka/cli/swarm.rb