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



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/karafka/pro/routing/features/offset_metadata.rb', line 41

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::OffsetMetadata::Listener.new
    )
  end
end