Module: Karafka::Pro::Routing::Features::ConsumerGroups::OffsetMetadata::Topic
- Defined in:
- lib/karafka/pro/routing/features/consumer_groups/offset_metadata/topic.rb
Overview
Commit Metadata API extensions
Instance Method Summary collapse
-
#initialize ⇒ Object
This method sets up the extra instance variable to nil before calling the parent class initializer.
-
#offset_metadata(cache: true, deserializer: STRING_DESERIALIZER) ⇒ Config
This feature config.
-
#offset_metadata? ⇒ true
Is offset metadata active (it always is).
-
#to_h ⇒ Hash
Topic with all its native configuration options plus offset metadata settings.
Instance Method Details
#initialize ⇒ Object
This method sets up the extra instance variable to nil before calling the parent class initializer. The explicit initialization to nil is included as an optimization for Ruby’s object shapes system, which improves memory layout and access performance.
58 59 60 61 |
# File 'lib/karafka/pro/routing/features/consumer_groups/offset_metadata/topic.rb', line 58 def initialize(...) @offset_metadata = nil super end |
#offset_metadata(cache: true, deserializer: STRING_DESERIALIZER) ⇒ Config
Returns this feature config.
67 68 69 70 71 72 73 |
# File 'lib/karafka/pro/routing/features/consumer_groups/offset_metadata/topic.rb', line 67 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).
76 77 78 |
# File 'lib/karafka/pro/routing/features/consumer_groups/offset_metadata/topic.rb', line 76 def .active? end |
#to_h ⇒ Hash
Returns topic with all its native configuration options plus offset metadata settings.
82 83 84 85 86 |
# File 'lib/karafka/pro/routing/features/consumer_groups/offset_metadata/topic.rb', line 82 def to_h super.merge( offset_metadata: .to_h ).freeze end |