Class: Karafka::BaseConsumer
- Inherits:
-
Object
- Object
- Karafka::BaseConsumer
- Extended by:
- ActiveSupport::DescendantsTracker, Forwardable
- Defined in:
- lib/karafka/base_consumer.rb
Overview
Base consumer from which all Karafka consumers should inherit
Class Attribute Summary collapse
-
.topic ⇒ Object
Returns the value of attribute topic.
Instance Attribute Summary collapse
-
#params_batch ⇒ Karafka::Params::ParamsBatch
writeonly
Creates lazy loaded params batch object.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the default consumer flow.
-
#topic ⇒ Karafka::Routing::Topic
Topic to which a given consumer is subscribed.
Class Attribute Details
.topic ⇒ Object
Returns the value of attribute topic.
18 19 20 |
# File 'lib/karafka/base_consumer.rb', line 18 def topic @topic end |
Instance Attribute Details
#params_batch=(messages) ⇒ Karafka::Params::ParamsBatch
Note:
Until first params usage, it won’t parse data at all
Creates lazy loaded params batch object
40 41 42 |
# File 'lib/karafka/base_consumer.rb', line 40 def params_batch=() @params_batch = Karafka::Params::ParamsBatch.new(, topic.parser) end |
Instance Method Details
#call ⇒ Object
Executes the default consumer flow.
45 46 47 |
# File 'lib/karafka/base_consumer.rb', line 45 def call process end |
#topic ⇒ Karafka::Routing::Topic
Returns topic to which a given consumer is subscribed.
31 32 33 |
# File 'lib/karafka/base_consumer.rb', line 31 def topic self.class.topic end |