Class: Karafka::BaseConsumer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/karafka/base_consumer.rb

Overview

Base consumer from which all Karafka consumers should inherit

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic) ⇒ BaseConsumer

Assigns a topic to a consumer and builds up proper consumer functionalities

so that it can cooperate with the topic settings

Parameters:



31
32
33
34
# File 'lib/karafka/base_consumer.rb', line 31

def initialize(topic)
  @topic = topic
  Consumers::Includer.call(self)
end

Instance Attribute Details

#params_batchKarafka::Params:ParamsBatch

Returns current params batch.

Returns:

  • (Karafka::Params:ParamsBatch)

    current params batch



26
27
28
# File 'lib/karafka/base_consumer.rb', line 26

def params_batch
  @params_batch
end

#topicKarafka::Routing::Topic (readonly)

Returns topic to which a given consumer is subscribed.

Returns:



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

def topic
  @topic
end

Instance Method Details

#callObject

Executes the default consumer flow.



37
38
39
# File 'lib/karafka/base_consumer.rb', line 37

def call
  process
end