mostafa/xk6-kafka

Wrong documentation for ReaderConfig.startOffset

Closed this issue · 3 comments

According to the documentation the valid values for ReaderConfig.startOffset (https://github.com/mostafa/xk6-kafka/blob/main/api-docs/docs/interfaces/ReaderConfig.md#startoffset) are the constants START_OFFSETS_FIRST_OFFSET and START_OFFSETS_LAST_OFFSET.

Those two constants are not included in the module-level constants (see console.log(kafka);) and therefor have no value set and do not work.
The module-level constants include the constants FIRST_OFFSET and LAST_OFFSET though (which work fine).

Hey @AndreasKorn,

Happy to see contributions.

I tried using both START_OFFSETS_LAST_OFFSET and LAST_OFFSET, but didn't work for me.
The consumer always gets the first offset message in the topic, instead of last one.
Here is my Reader config. Did I miss anything?

import {
LAST_OFFSET,
} from "k6/x/kafka";

const sinkTopicReader = new Reader({
brokers: brokers,
partition: 0,
groupTopics: [sinkTopic],
groupID: "test-consumer-group",
startOffset: LAST_OFFSET,
});

Hi,
I actually still have issues reading from latest offset from particular topic and partition. Is there any possibility to properly document and confirm what is the correct way to use START_OFFSETS_LAST_OFFSET or LAST_OFFSET?
Thanx a lot.
Miro