Module: Karafka::Routing::Features::ManualOffsetManagement::Topic

Defined in:
lib/karafka/routing/features/manual_offset_management/topic.rb

Overview

Topic extensions to be able to manage manual offset management settings

Instance Method Summary collapse

Instance Method Details

#manual_offset_management(active = false) ⇒ Config

Note:

Since this feature supports only one setting (active), we can use the old API

where the boolean would be an argument

Parameters:

  • active (Boolean) (defaults to: false)

    should we stop managing the offset in Karafka and make the user responsible for marking messages as consumed.

Returns:



15
16
17
# File 'lib/karafka/routing/features/manual_offset_management/topic.rb', line 15

def manual_offset_management(active = false)
  @manual_offset_management ||= Config.new(active: active)
end

#manual_offset_management?Boolean

Returns is manual offset management enabled for a given topic.

Returns:

  • (Boolean)

    is manual offset management enabled for a given topic



20
21
22
# File 'lib/karafka/routing/features/manual_offset_management/topic.rb', line 20

def manual_offset_management?
  manual_offset_management.active?
end

#to_hHash

Returns topic with all its native configuration options plus manual offset management namespace settings.

Returns:

  • (Hash)

    topic with all its native configuration options plus manual offset management namespace settings



26
27
28
29
30
# File 'lib/karafka/routing/features/manual_offset_management/topic.rb', line 26

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