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

SinkTask - Use RetriableException to avoid losing messages #57

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

Conversation

JavierMonton
Copy link

@JavierMonton JavierMonton commented Jan 30, 2025

Hello 👋,
I hope this helps.

When the client.send fails during the put operation, as I believe it's asynchronous, it might commit offsets before getting the error, so messages might be lost.

As an example, this is what happens when using a wrong SQS URL
imagen

It consumes a few messages and then it stops.

According to the docs, returning a RetriableException rather than RuntimeException forces Kafka Connect to retry the operation, which also ensures that messages are not committed.

This change fixes #3

A simple way of testing this is to create a new connector with a wrong SQS URL, the current code starts consuming and committing some offsets until it detects the exception and stops.
I tried this change in a fork and it fails before committing offsets, so no messages are lost.

I'm not sure if there are other ways of losing messages, but at least this improves the initial time when a wrong URL is provided. I'll be testing it more in the coming days as we want to use the connector :)

Copy link

@vijaya314 vijaya314 left a comment

Choose a reason for hiding this comment

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

looks good.

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.

The sqs-sink drop events when sqs sending fails
2 participants