module Karafka::Consumers::Callbacks
Additional callbacks that can be used to trigger some actions on certain moments like manual offset management, committing or anything else outside of a standard messages flow They are not included by default, as we don't want to provide functionalities that are not required by users by default Please refer to the wiki callbacks page for more details on how to use them
Constants
- TYPES
Types of events on which we run callbacks
Public Class Methods
included(consumer_class)
click to toggle source
@param consumer_class [Class] consumer class that we extend with callbacks
# File lib/karafka/consumers/callbacks.rb, line 49 def included(consumer_class) consumer_class.class_eval do extend ClassMethods end end
Public Instance Methods
call()
click to toggle source
Executes the default consumer flow, runs callbacks and if not halted will call process method of a proper backend. It is here because it interacts with the default Karafka
call flow and needs to be overwritten to support callbacks
# File lib/karafka/consumers/callbacks.rb, line 59 def call if self.class.respond_to?(:after_fetch) Karafka::App.monitor.instrument( "consumers.#{Helpers::Inflector.map(self.class.to_s)}.after_fetch", context: self ) end process end