Module: Karafka::Pro::Routing::Features::OffsetMetadata::Topic

Defined in:
lib/karafka/pro/routing/features/offset_metadata/topic.rb

Overview

Commit Metadata API extensions

Instance Method Summary collapse

Instance Method Details

#offset_metadata(cache: true, deserializer: STRING_DESERIALIZER) ⇒ Config

Returns this feature config.

Parameters:

  • cache (Boolean) (defaults to: true)

    should we cache the response until rebalance

  • deserializer (#call) (defaults to: STRING_DESERIALIZER)

    deserializer that will get raw data and should return deserialized metadata

Returns:

  • (Config)

    this feature config



40
41
42
43
44
45
46
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 40

def (cache: true, deserializer: STRING_DESERIALIZER)
  @offset_metadata ||= Config.new(
    active: true,
    cache: cache,
    deserializer: deserializer
  )
end

#offset_metadata?true

Returns is offset metadata active (it always is).

Returns:

  • (true)

    is offset metadata active (it always is)



49
50
51
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 49

def offset_metadata?
  .active?
end

#to_hHash

Returns topic with all its native configuration options plus offset metadata settings.

Returns:

  • (Hash)

    topic with all its native configuration options plus offset metadata settings



55
56
57
58
59
# File 'lib/karafka/pro/routing/features/offset_metadata/topic.rb', line 55

def to_h
  super.merge(
    offset_metadata: .to_h
  ).freeze
end