-
Notifications
You must be signed in to change notification settings - Fork 54
HTTP-182 HTTP sink retries #181
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
Open
jonathanlehto
wants to merge
9
commits into
getindata:main
Choose a base branch
from
jonathanlehto:http-sink-retries
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c86109d
Enable HTTP Sink request retries
387c37c
Add tests
356e224
Add RateLimitingStrategy
f984210
Add Http Sink capability, DeliveryMode support, introduce http lookup…
jonathanlehto 392e1f8
Merge branch 'main' into http-sink-retries
jonathanlehto 16a90ee
Add Http Sink capability, DeliveryMode support, introduce http lookup…
jonathanlehto e1131a6
addressed code review comments, README updates, SinkHttpClientRespons…
jonathanlehto a8e4821
update changelog and readme
jonathanlehto d0ddbea
update white/black terminology to approve/deny
jonathanlehto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
17 changes: 17 additions & 0 deletions
17
...main/java/com/getindata/connectors/http/BatchHttpStatusCodeValidationFailedException.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.getindata.connectors.http; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import lombok.Getter; | ||
|
|
||
| import com.getindata.connectors.http.internal.sink.httpclient.HttpRequest; | ||
|
|
||
| @Getter | ||
| public class BatchHttpStatusCodeValidationFailedException extends Exception { | ||
| private final List<HttpRequest> failedRequests; | ||
|
|
||
| public BatchHttpStatusCodeValidationFailedException(String message, List<HttpRequest> failedRequests) { | ||
| super(message); | ||
| this.failedRequests = failedRequests; | ||
| } | ||
| } |
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
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
42 changes: 34 additions & 8 deletions
42
src/main/java/com/getindata/connectors/http/internal/SinkHttpClientResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,57 @@ | ||
| package com.getindata.connectors.http.internal; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.NonNull; | ||
| import lombok.ToString; | ||
|
|
||
| import com.getindata.connectors.http.internal.config.ResponseItemStatus; | ||
| import com.getindata.connectors.http.internal.sink.HttpSinkRequestEntry; | ||
| import com.getindata.connectors.http.internal.sink.httpclient.HttpRequest; | ||
|
|
||
| /** | ||
| * Data class holding {@link HttpSinkRequestEntry} instances that {@link SinkHttpClient} attempted | ||
| * to write, divided into two lists — successful and failed ones. | ||
| * to write. | ||
| */ | ||
| @Data | ||
| @ToString | ||
| public class SinkHttpClientResponse { | ||
|
|
||
| /** | ||
| * A list of successfully written requests. | ||
| * A list of requests along with write status. | ||
| */ | ||
| @NonNull | ||
| private final List<HttpRequest> successfulRequests; | ||
| private final List<ResponseItem> requests; | ||
|
|
||
| /** | ||
| * A list of requests that {@link SinkHttpClient} failed to write. | ||
| */ | ||
| @NonNull | ||
| private final List<HttpRequest> failedRequests; | ||
| private List<HttpRequest> getRequestByStatus(final ResponseItemStatus status) { | ||
| return requests.stream() | ||
| .filter(r -> r.getStatus().equals(status)) | ||
| .map(ResponseItem::getRequest) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| public List<HttpRequest> getSuccessfulRequests() { | ||
| return getRequestByStatus(ResponseItemStatus.SUCCESS); | ||
| } | ||
|
|
||
| public List<HttpRequest> getFailedRequests() { | ||
| return getRequestByStatus(ResponseItemStatus.FAILURE); | ||
| } | ||
|
|
||
| public List<HttpRequest> getTemporalRequests() { | ||
| return getRequestByStatus(ResponseItemStatus.TEMPORAL); | ||
| } | ||
|
|
||
| public List<HttpRequest> getIgnoredRequests() { | ||
| return getRequestByStatus(ResponseItemStatus.IGNORE); | ||
| } | ||
|
|
||
| @Data | ||
| @ToString | ||
| public static class ResponseItem { | ||
| private final HttpRequest request; | ||
| private final ResponseItemStatus status; | ||
| } | ||
| } |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/getindata/connectors/http/internal/config/ResponseItemStatus.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.getindata.connectors.http.internal.config; | ||
|
|
||
| public enum ResponseItemStatus { | ||
| SUCCESS("success"), | ||
| TEMPORAL("temporal"), | ||
| IGNORE("ignore"), | ||
| FAILURE("failure"); | ||
|
|
||
| private final String status; | ||
|
|
||
| ResponseItemStatus(String status) { | ||
| this.status = status; | ||
| } | ||
|
|
||
| public String getStatus() { | ||
| return status; | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.