Repository navigation
Conversation
Send an Idempotency-Key (v4 UUID) with every POST/PUT/DELETE so a request whose outcome is unknown can be retried safely. - SeatsioException exposes idempotencyKey and outcomeIsUnknown() (connection failure, 5xx, or key still in use after retries) - SeatsioClient.withIdempotencyKey(key) returns a client that reuses a key; rejects non-v4-UUID keys - Retry 409 IDEMPOTENCY_KEY_IN_USE with backoff, like 429 - retryNonIdempotentRequests(true) opts in to retrying POST/PUT/DELETE on connection errors with the same key (off by default) - Stop retrying when the thread is interrupted - Error bodies without an error code no longer break parsing: errors and requestId are null, message contains status and body (ErrorResponse) - README: document idempotency, retries and the new exception fields
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The review reports no active issues with the Java client’s idempotency and retry changes.
No open issues 🎉
What changed in this PR
Adds idempotency support to the Java client so callers can safely retry write requests with unknown outcomes when idempotency is enabled for their company.
Changes:
- Adds generated UUID keys to write requests and client copies that reuse a supplied key.
- Adds retries for keys still in use, opt-in connection-failure retries, and interruption handling.
- Exposes retry-related exception details, improves error-response handling, and adds tests and documentation.
| File | Description |
|---|---|
src/test/java/seatsio/SeatsioClientTest.java |
Adds setup for companies with idempotency enabled. |
src/test/java/seatsio/IdempotentRetryTest.java |
Tests retry policies, key reuse, interruption, and unknown outcomes. |
src/test/java/seatsio/IdempotencyKeyTest.java |
Tests key generation, validation, headers, and exception exposure. |
src/test/java/seatsio/FakeServer.java |
Adds a local server for scripted responses and connection failures. |
src/test/java/seatsio/events/IdempotencyTest.java |
Adds integration tests for response replay and lost-response recovery. |
src/test/java/seatsio/ErrorResponseTest.java |
Tests fallback handling for unstructured error responses. |
src/main/java/seatsio/util/UnirestWrapper.java |
Implements key attachment, shared retry settings, and retry control. |
src/main/java/seatsio/util/ErrorResponse.java |
Centralizes structured error-response parsing. |
src/main/java/seatsio/SeatsioException.java |
Exposes idempotency keys and unknown outcomes; updates error construction. |
src/main/java/seatsio/SeatsioClient.java |
Adds APIs for key reuse and opt-in write retries. |
src/main/java/seatsio/exceptions/RateLimitExceededException.java |
Adds a message-only constructor for fallback errors. |
README.md |
Documents idempotency, retry settings, and exception fields. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Send an Idempotency-Key (v4 UUID) with every POST/PUT/DELETE so a request whose outcome is unknown can be retried safely.