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

Kafka :: message failure handling #1279

Open
wajda opened this issue Oct 11, 2023 · 2 comments
Open

Kafka :: message failure handling #1279

wajda opened this issue Oct 11, 2023 · 2 comments

Comments

@wajda
Copy link
Contributor

wajda commented Oct 11, 2023

Problem

At the moment the Kafka consumer is implemented in a way that all messages are automatically acknowledged regardless if the processing was successful or not. This would lead to data loss in case of database failure, or a processing timeout due to the message size, for example.

Goal

We need to implement a robust error handling strategy.

Solution proposal

Based on the error type, we can decide if the error is persistent or temporary and apply different logic for each type:

Persistent errors

The error is considered persistent if it's evident or very likely that the error would re-occur on any retry processing attempt in the future. For example, the message is malformed or invalid, or it contradicts the current state of the database (e.g. constraint violation) . In such cases we would acknowledge the message and send it to the dead letters topic, where it would sit and wait manual intervention.

Temporary errors

It the database is experiencing issues, an unexpected error happens in the app code, or a message dependency aren't fulfilled, we know that the situation that lead to the error is rather temporary and might be fixed soon. In that case we would acknowledge the message and send it to a retry topic, from where the messaged would be automatically pulled and retried periodically.

@wajda wajda added this to the 0.7.9 milestone Oct 11, 2023
@cerveada cerveada added this to Spline Oct 11, 2023
@github-project-automation github-project-automation bot moved this to New in Spline Oct 11, 2023
@wajda wajda added the feature label Oct 11, 2023
@wajda wajda moved this from New to Backlog in Spline Oct 11, 2023
@cerveada
Copy link
Contributor

At the moment the Kafka consumer is implemented in a way that all messages are automatically acknowledged regardless if the processing was successful or not.

Are you sure? I thought it will not acknowledge the message if the underlying layer throws an error.

@wajda
Copy link
Contributor Author

wajda commented Oct 12, 2023

Yes, I'm sure. I specifically verified it yesterday.

@wajda wajda modified the milestones: 0.7.9, 0.7.10 Jan 26, 2024
@wajda wajda modified the milestones: 0.7.10, 1.0.0 Jul 4, 2024
@wajda wajda modified the milestones: 1.0.0, 1.1.0 Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants