Class: Karafka::Pro::Routing::Features::OffsetMetadata

Inherits:
Base show all
Defined in:
lib/karafka/pro/routing/features/offset_metadata.rb,
lib/karafka/pro/routing/features/offset_metadata/topic.rb,
lib/karafka/pro/routing/features/offset_metadata/config.rb,
lib/karafka/pro/routing/features/offset_metadata/contracts/topic.rb

Overview

Note:

Because this feature has zero performance impact and makes no queries to Kafka unless requested, it is always enabled.

This feature allows for saving and retrieving offset metadata with custom deserialization support. It allows for storing extra data during commits that can be then used to alter the processing flow after a rebalance.

Defined Under Namespace

Modules: Contracts, Topic Classes: Config

Class Method Summary collapse

Methods inherited from Routing::Features::Base

activate, load_all, post_setup_all, pre_setup_all

Class Method Details

.post_setup(_config) ⇒ Object

If needed installs the needed listener and initializes tracker

Parameters:

  • _config (Karafka::Core::Configurable::Node)

    app config



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/karafka/pro/routing/features/offset_metadata.rb', line 33

def post_setup(_config)
  Karafka::App.monitor.subscribe('app.running') do
    # Initialize the tracker prior to becoming multi-threaded
    Karafka::Processing::InlineInsights::Tracker.instance

    # Subscribe to the statistics reports and collect them
    Karafka.monitor.subscribe(
      Karafka::Pro::Processing::::Listener.new
    )
  end
end