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

Manipulation of offsetRanges in each batch #66

Open
Bonnie16 opened this issue Oct 14, 2019 · 0 comments
Open

Manipulation of offsetRanges in each batch #66

Bonnie16 opened this issue Oct 14, 2019 · 0 comments

Comments

@Bonnie16
Copy link

hello, I am using spark streaming and kafka java api, version of org.apache.spark (version 2.3.0) and org.apache.kafka(0.10).

I am using sample code provided here: https://spark.apache.org/docs/2.3.1/streaming-kafka-0-10-integration.html. But I made some modifications to the OffsetRanges in each batch like show below

stream.foreachRDD(rdd -> {
OffsetRange[] offsetRanges = ((HasOffsetRanges) rdd.rdd()).offsetRanges();

// make some change to the OffsetRanges
...

// some time later, after outputs have completed
((CanCommitOffsets) stream.inputDStream()).commitAsync(offsetRanges);

});
The problem is after modificaiton(the offset ranges did change) and commitAsync, I did not receive OffsetRanges as I expected in the next batch.

How should I resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant