Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can we know the topic details(current offset etc) of a particular topic? #226

Closed
arpitaso opened this issue Jun 20, 2023 · 5 comments
Closed
Labels
❓ Question Further information is requested

Comments

@arpitaso
Copy link

@mostafa
I have set the below offset and
let offset = 0;
but the topic always reads data from 0th offset, in our use case we want to consume data from current offset.
Is there any way to do so?

@mostafa
Copy link
Owner

mostafa commented Jun 22, 2023

@arpitaso

You can pass the start offset by populating it in the ReaderConfig.

@mostafa mostafa added the ❓ Question Further information is requested label Jun 22, 2023
@mostafa
Copy link
Owner

mostafa commented Jul 12, 2023

@arpitaso

I suppose this is resolved. Feel free to reopen it if the issue persists.

@mostafa mostafa closed this as completed Jul 12, 2023
@arpitaso
Copy link
Author

@mostafa
i tried the above

import {
    Writer,
    Reader,
    Connection,
    SchemaRegistry,
    SCHEMA_TYPE_JSON,
    SASL_SCRAM_SHA512, START_OFFSETS
} from "k6/x/kafka";

  reader = new Reader({
        brokers: brokers,
        topic: topic,
        partition: partition,
        offset: START_OFFSETS.START_OFFSETS_LAST_OFFSET,
        sasl: saslConfig,
        tls: tlsConfig,
    });
    
but it gives the below error
    ERRO[0002] TypeError: Cannot read property 'START_OFFSETS_LAST_OFFSET' of undefined
running at file:///Users/arpita.sood/Documents/Maersk_code/sre-perf-ls-test-demo/dev_latest/dev-test.js:96:30(56)  executor=shared-iterations scenario=default source=stacktrace

@mostafa
Copy link
Owner

mostafa commented Jul 16, 2023

@arpitaso
import START_OFFSETS_LAST_OFFSET directly.

@shreya-haridas
Copy link

@arpitaso
it actually should be startOffset: LAST_OFFSET

see #281 for more clarity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants