-
Notifications
You must be signed in to change notification settings - Fork 45
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
HTTP-42 Add support for Batch request submission in HTTP Sink. #58
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
189a7c0
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 2dd1135
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 8c314fe
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 627b54a
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC b327c31
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC ea9fff3
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC b78ff43
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC bbcb439
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 26db840
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 2f4b615
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC c92a6e2
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 6d7de3e
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 4797cbf
HTTP-42-BatchRequest - add support for batch request processing in HT…
kristoffSC 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 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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
src/main/java/com/getindata/connectors/http/internal/config/SinkRequestSubmitMode.java
This file contains 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.internal.config; | ||
|
||
public enum SinkRequestSubmitMode { | ||
|
||
SINGLE("single"), | ||
BATCH("batch"); | ||
|
||
private final String mode; | ||
|
||
SinkRequestSubmitMode(String mode) { | ||
this.mode = mode; | ||
} | ||
|
||
public String getMode() { | ||
return mode; | ||
} | ||
} |
This file contains 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
49 changes: 49 additions & 0 deletions
49
...java/com/getindata/connectors/http/internal/sink/httpclient/AbstractRequestSubmitter.java
This file contains 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,49 @@ | ||
package com.getindata.connectors.http.internal.sink.httpclient; | ||
|
||
import java.net.http.HttpClient; | ||
import java.util.Properties; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
|
||
import org.apache.flink.util.concurrent.ExecutorThreadFactory; | ||
|
||
import com.getindata.connectors.http.internal.config.HttpConnectorConfigConstants; | ||
import com.getindata.connectors.http.internal.utils.ThreadUtils; | ||
|
||
public abstract class AbstractRequestSubmitter implements RequestSubmitter { | ||
|
||
protected static final int HTTP_CLIENT_PUBLISHING_THREAD_POOL_SIZE = 1; | ||
|
||
protected static final String DEFAULT_REQUEST_TIMEOUT_SECONDS = "30"; | ||
|
||
/** | ||
* Thread pool to handle HTTP response from HTTP client. | ||
*/ | ||
protected final ExecutorService publishingThreadPool; | ||
|
||
protected final int httpRequestTimeOutSeconds; | ||
|
||
protected final String[] headersAndValues; | ||
|
||
protected final HttpClient httpClient; | ||
|
||
public AbstractRequestSubmitter( | ||
Properties properties, | ||
String[] headersAndValues, | ||
HttpClient httpClient) { | ||
|
||
this.headersAndValues = headersAndValues; | ||
this.publishingThreadPool = | ||
Executors.newFixedThreadPool( | ||
HTTP_CLIENT_PUBLISHING_THREAD_POOL_SIZE, | ||
new ExecutorThreadFactory( | ||
"http-sink-client-response-worker", ThreadUtils.LOGGING_EXCEPTION_HANDLER)); | ||
|
||
this.httpRequestTimeOutSeconds = Integer.parseInt( | ||
properties.getProperty(HttpConnectorConfigConstants.SINK_HTTP_TIMEOUT_SECONDS, | ||
DEFAULT_REQUEST_TIMEOUT_SECONDS) | ||
); | ||
|
||
this.httpClient = httpClient; | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is base class for PerReqeust and Batch submitter implementations.