forked from opensearch-project/data-prepper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to use interface so default behavior is unaffected. Add tests
Signed-off-by: Chase Engelbrecht <[email protected]>
- Loading branch information
Showing
8 changed files
with
319 additions
and
38 deletions.
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
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
11 changes: 11 additions & 0 deletions
11
...ain/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/InlineRequestSender.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,11 @@ | ||
package org.opensearch.dataprepper.plugins.sink.opensearch.bulk; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public class InlineRequestSender implements RequestSender { | ||
|
||
@Override | ||
public void sendRequest(final Consumer<AccumulatingBulkRequest> requestConsumer, final AccumulatingBulkRequest request) { | ||
requestConsumer.accept(request); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../src/main/java/org/opensearch/dataprepper/plugins/sink/opensearch/bulk/RequestSender.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,13 @@ | ||
package org.opensearch.dataprepper.plugins.sink.opensearch.bulk; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public interface RequestSender { | ||
/** | ||
* Executes the provided request with the provided consumer | ||
* | ||
* @param requestConsumer - the consumer function of the request that performs the work to execute the request | ||
* @param request - the request to be consumed | ||
*/ | ||
void sendRequest(Consumer<AccumulatingBulkRequest> requestConsumer, AccumulatingBulkRequest request); | ||
} |
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
Oops, something went wrong.