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

GH-3078: Compute Seek Position from Current Offset #3099

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

sobychacko
Copy link
Contributor

Fixes: #3078

  • Provide a new API method in ConsumerSeekCallback to seek to an offset based on the current offset. This is accomplished by a user-defined function where the user can make decision on the offset to seek to based on the current offset which is available via the function's input.
  • Adding tests, docs.

Fixes: spring-projects#3078

 * Provide a new API method in `ConsumerSeekCallback` to seek to an offset
   based on the current offset. This is accomplished by a user-defined function
   where the user can make decision on the offset to seek to based on the current
   offset which is available via the function's input.
 * Adding tests, docs.
@sobychacko sobychacko requested a review from artembilan March 5, 2024 01:06
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Just a couple nit-picks in docs.
Thanks

@@ -49,6 +51,11 @@ void seekToTimestamp(String topic, int partition, long timestamp);
void seekToTimestamp(Collection<TopicPartition> topicPartitions, long timestamp);
----

The two different variants of the `seek` methods provide a way to seek to an arbitrary offset.
The method that takes a `Function` as an argument to compute the offset was added in version `3.2` of the framework.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our preference to not make just version number as a code.

[[x32-seek-offset-compute-fn]]
=== New API method to seek to an offset based on a user provided function
`ConsumerCallback` provides a new API to seek to an offset based on a user-defined function, which takes the current offset in the consumer as an argument.
See xref:kafka/seek.adoc#seek/[Seek API Docs] for more details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that slash in the end of link is a mistake.

@artembilan artembilan merged commit 29f8d18 into spring-projects:main Mar 5, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Compute New Seek Position From Current Offset
2 participants