Skip to content

Add method to fetch messages in batch #1390

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

krsoninikhil
Copy link

Since FetchMessage is already reading messages from a fetched batch, this new method just hold the messages util the batchSize number of messages are read.

Fixes #123

i++
}
return msgBatch, nil
}
Copy link
Author

@krsoninikhil krsoninikhil Jun 8, 2025

Choose a reason for hiding this comment

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

Duplication of the code can be avoided by calling this method in FetchMessage. I'll refactor if once the approach gets reviewed.

Copy link

@ghaninia ghaninia Jun 8, 2025

Choose a reason for hiding this comment

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

What happens if the number of messages doesn't reach the desired batchSize?

you changed the offset when the batch is processed, what happens if one of the messages in the batch fails? Is there any mechanism in place to handle that? Do you have any ideas for a fallback strategy for this?!

@krsoninikhil

Copy link

Choose a reason for hiding this comment

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

@ghaninia for batch processing possible use manuall ack, maybe?

If one of message failed, we can ack all messages before failed, except message with problem.

Since FetchMessage is already reading messages from a fetched
batch, this new method just hold the messages util the batchSize
number of messages are read.

Fixes segmentio#123
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.

Way to get batch messages and commit if the batch is successful
3 participants