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

Calling seek within eachMessage does not abort the current batch #98

Closed
Nevon opened this issue Jul 29, 2018 · 1 comment
Closed

Calling seek within eachMessage does not abort the current batch #98

Nevon opened this issue Jul 29, 2018 · 1 comment

Comments

@Nevon
Copy link
Collaborator

Nevon commented Jul 29, 2018

In my dead-letter queue plugin, when I fail to send a message to the dead-letter queue, I need to seek back to the failed message in order to re-process it. This works, as on the subsequent fetch, the message will be re-processed. However, the current batch is first completed, which means that any other messages in the batch after the one that fails gets processed twice.

https://github.com/Nevon/kafkajs-dlq/blob/5a6f00c3de75abf71640a88ff564ab5a5691f7a6/src/consumer.integration.spec.js#L149-L163

I would like a way to abort the current batch. Either immediately as an effect of calling seek within eachMessage, or in some other way (perhaps by throwing a specific type of error).

@Nevon
Copy link
Collaborator Author

Nevon commented Jul 30, 2018

This can be achieved by just throwing any exception, as it will be retried.

@Nevon Nevon closed this as completed Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant