Sha256: 91a48764c1032a4853c949d48b3bcc81a11220e829b473047cd7894ad432e003

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Karafka
  # Karafka framework Cli
  class Cli < Thor
    # Server Karafka Cli action
    class Server < Base
      include Helpers::Colorize

      desc 'Start the Karafka server (short-cut alias: "s")'
      option aliases: 's'
      option :consumer_groups, type: :array, default: nil, aliases: :g

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

        Contracts::ServerCliOptions.new.validate!(cli.options)

        # We assign active topics on a server level, as only server is expected to listen on
        # part of the topics
        Karafka::Server.consumer_groups = cli.options[:consumer_groups]

        Karafka::Server.run
      end

      private

      # Prints marketing info
      def print_marketing_info
        Karafka.logger.info Info::BANNER

        if Karafka.pro?
          Karafka.logger.info(
            green('Thank you for using Karafka Pro!')
          )
        else
          Karafka.logger.info(
            red('Upgrade to Karafka Pro for more features and support: https://karafka.io')
          )
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
karafka-2.0.21 lib/karafka/cli/server.rb
karafka-2.0.20 lib/karafka/cli/server.rb
karafka-2.0.19 lib/karafka/cli/server.rb
karafka-2.0.18 lib/karafka/cli/server.rb
karafka-2.0.17 lib/karafka/cli/server.rb
karafka-2.0.16 lib/karafka/cli/server.rb
karafka-2.0.15 lib/karafka/cli/server.rb
karafka-2.0.14 lib/karafka/cli/server.rb
karafka-2.0.13 lib/karafka/cli/server.rb
karafka-2.0.12 lib/karafka/cli/server.rb
karafka-2.0.11 lib/karafka/cli/server.rb
karafka-2.0.10 lib/karafka/cli/server.rb
karafka-2.0.9 lib/karafka/cli/server.rb
karafka-2.0.8 lib/karafka/cli/server.rb
karafka-2.0.7 lib/karafka/cli/server.rb
karafka-2.0.6 lib/karafka/cli/server.rb
karafka-2.0.5 lib/karafka/cli/server.rb
karafka-2.0.4 lib/karafka/cli/server.rb
karafka-2.0.3 lib/karafka/cli/server.rb