Class: Karafka::BaseConsumer
- Inherits:
-
Object
- Object
- Karafka::BaseConsumer
- Extended by:
- Forwardable
- Defined in:
- lib/karafka/base_consumer.rb
Overview
Base consumer from which all Karafka consumers should inherit
Instance Attribute Summary collapse
-
#params_batch ⇒ Karafka::Params:ParamsBatch
Current params batch.
-
#topic ⇒ Karafka::Routing::Topic
readonly
Topic to which a given consumer is subscribed.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the default consumer flow.
-
#initialize(topic) ⇒ BaseConsumer
constructor
Assigns a topic to a consumer and builds up proper consumer functionalities so that it can cooperate with the topic settings.
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
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_batch ⇒ Karafka::Params:ParamsBatch
Returns current params batch.
26 27 28 |
# File 'lib/karafka/base_consumer.rb', line 26 def params_batch @params_batch end |
#topic ⇒ Karafka::Routing::Topic (readonly)
Returns topic to which a given consumer is subscribed.
24 25 26 |
# File 'lib/karafka/base_consumer.rb', line 24 def topic @topic end |
Instance Method Details
#call ⇒ Object
Executes the default consumer flow.
37 38 39 |
# File 'lib/karafka/base_consumer.rb', line 37 def call process end |