Module: Karafka::Pro::Processing::OffsetMetadata::Consumer

Defined in:
lib/karafka/pro/processing/offset_metadata/consumer.rb

Overview

Note:

Part of this feature API is embedded directly into the strategies because it alters how marking methods (‘#mark_as_consumed` and `#mark_as_consumed!`) operate. Because of that, they had to be embedded into the strategies.

Extra API methods for offset metadata fetching

Instance Method Summary collapse

Instance Method Details

#offset_metadata(cache: true) ⇒ false, Object Also known as: committed_offset_metadata

Note:

Caching is on as the assumption here is, that most of the time user will be interested only in the offset metadata that “came” from the time prior to the rebalance. That is because the rest of the metadata (current) is created and controlled by the user himself, thus there is no need to retrieve it. In case this is not true and user wants to always get the Kafka metadata, ‘cache` value of this feature can be set to false.

Returns false in case we do not own the partition anymore or deserialized metadata based on the deserializer.

Parameters:

  • cache (Boolean) (defaults to: true)

    should we use cached result if present (true by default)

Returns:

  • (false, Object)

    false in case we do not own the partition anymore or deserialized metadata based on the deserializer



33
34
35
36
37
# File 'lib/karafka/pro/processing/offset_metadata/consumer.rb', line 33

def (cache: true)
  return false if revoked?

  Fetcher.find(topic, partition, cache: cache)
end