#357 Retry all REST requests on 409 errors #359
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #357
This uses a different approach than what was proposed in the issue, but the effect should be mostly the same. I drafted up the
retrying(() -> kafkaConnectApi.getConnectorConfig(conectorToPatch))
patch but realized that this would still have to be manually applied to all REST calls that could result in a 409 response, which seemed fairly brittle.I did some research and it looks like we can get retry logic with our auto-generated REST client for free by bringing in a small extra dependency: https://quarkus.io/guides/smallrye-fault-tolerance
Since the API for describing retriable requests with this library is based on exception class, I added custom subclasses to the
KafkaConnectException
to help us distinguish between retriable and non-retriable operations. We could theoretically create aRetriableKafkaConnectException
umbrella class for those, but that feels a little premature, especially since some exceptions may be retriable for only a subset of requests that throw them.I was able to get 10 consecutive green integration test runs locally with this patch.