Sha256: 648d12db9c56f285411f416d4fb7af76284f0031964252b8a7e68022383f5ac5

Contents?: true

Size: 1005 Bytes

Versions: 19

Compression:

Stored size: 1005 Bytes

Contents

# frozen_string_literal: true

module Sbmt
  module KafkaConsumer
    class Server < Karafka::Server
      class << self
        # original klass tries to validate karafka-specific server cli-options which we override
        # see Karafka::Server for details
        def run
          Karafka::Server.listeners = []
          Karafka::Server.workers = []

          process.on_sigint { Karafka::Server.stop }
          process.on_sigquit { Karafka::Server.stop }
          process.on_sigterm { Karafka::Server.stop }
          process.on_sigtstp { Karafka::Server.quiet }
          process.supervise

          $stdout.puts "Starting server"
          Karafka::Server.start

          sleep(0.1) until Karafka::App.terminated?
          # rubocop:disable Lint/RescueException
        rescue Exception => e
          $stdout.puts "Cannot start server: #{e.message}"

          # rubocop:enable Lint/RescueException
          Karafka::Server.stop

          raise e
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sbmt-kafka_consumer-3.3.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-3.2.2 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-3.2.1 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-3.2.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-3.1.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.8.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-3.0.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.7.1 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.7.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.6.1 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.6.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.5.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.4.1 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.4.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.3.1 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.3.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.2.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.1.0 lib/sbmt/kafka_consumer/server.rb
sbmt-kafka_consumer-2.0.0 lib/sbmt/kafka_consumer/server.rb