Class: Karafka::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/server.rb

Overview

Karafka consuming server class

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.consumer_groupsArray<String>

Returns array with names of consumer groups that should be consumed in a current server context.

Returns:

  • (Array<String>)

    array with names of consumer groups that should be consumed in a current server context



24
25
26
27
# File 'lib/karafka/server.rb', line 24

def consumer_groups
  # If not specified, a server will listed on all the topics
  @consumer_groups ||= Karafka::App.consumer_groups.map(&:name).freeze
end

.consumer_threadsObject

Set of consuming threads. Each consumer thread contains a single consumer



8
9
10
# File 'lib/karafka/server.rb', line 8

def consumer_threads
  @consumer_threads
end

Class Method Details

.runObject

Method which runs app



14
15
16
17
18
19
20
# File 'lib/karafka/server.rb', line 14

def run
  @consumer_threads = Concurrent::Array.new
  bind_on_sigint
  bind_on_sigquit
  bind_on_sigterm
  start_supervised
end