Class: Kafka::FetchedBatchGenerator
- Inherits:
-
Object
- Object
- Kafka::FetchedBatchGenerator
- Defined in:
- lib/kafka/fetched_batch_generator.rb
Constant Summary collapse
- COMMITTED_TRANSACTION_SIGNAL =
"\x00\x00\x00\x01".freeze
- ABORTED_TRANSACTION_SIGNAL =
"\x00\x00\x00\x00".freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(topic, fetched_partition, offset, logger:) ⇒ FetchedBatchGenerator
constructor
A new instance of FetchedBatchGenerator.
Constructor Details
#initialize(topic, fetched_partition, offset, logger:) ⇒ FetchedBatchGenerator
Returns a new instance of FetchedBatchGenerator.
10 11 12 13 14 15 |
# File 'lib/kafka/fetched_batch_generator.rb', line 10 def initialize(topic, fetched_partition, offset, logger:) @topic = topic @fetched_partition = fetched_partition @logger = TaggedLogger.new(logger) @offset = offset end |
Instance Method Details
#generate ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/kafka/fetched_batch_generator.rb', line 17 def generate if @fetched_partition..empty? empty_fetched_batch elsif @fetched_partition..first.is_a?(Kafka::Protocol::MessageSet) else extract_records end end |