-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature/extensions] Adding ActionListener onFailure to ExtensionsOrc…
…hestrator (#4191) * Added ActionListener onFailure logic to ExtensionsOrchestrator Signed-off-by: Ryan Bogan <[email protected]> * Addressed PR Comments Signed-off-by: Ryan Bogan <[email protected]> * Addressed PR Comments Signed-off-by: Ryan Bogan <[email protected]> * Changed success and failure count to response count Signed-off-by: Ryan Bogan <[email protected]> * Modified CHANGELOG.md Signed-off-by: Ryan Bogan <[email protected]> * Addressed PR Comments Signed-off-by: Ryan Bogan <[email protected]> * Addressed PR Comments Signed-off-by: Ryan Bogan <[email protected]> * Addressed PR Comments Signed-off-by: Ryan Bogan <[email protected]> Signed-off-by: Ryan Bogan <[email protected]>
- Loading branch information
Showing
5 changed files
with
118 additions
and
21 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
50 changes: 50 additions & 0 deletions
50
server/src/main/java/org/opensearch/extensions/ExtensionActionListener.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,50 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.extensions; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.action.ActionListener; | ||
import org.opensearch.action.admin.indices.analyze.AnalyzeAction.Response; | ||
|
||
/** | ||
* ActionListener for ExtensionsOrchestrator | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class ExtensionActionListener<ExtensionBooleanResponse> implements ActionListener<Response> { | ||
|
||
private static final Logger logger = LogManager.getLogger(ExtensionActionListener.class); | ||
private ArrayList<Exception> exceptionList; | ||
|
||
public ExtensionActionListener() { | ||
exceptionList = new ArrayList<Exception>(); | ||
} | ||
|
||
@Override | ||
public void onResponse(Response response) { | ||
logger.info("response {}", response); | ||
} | ||
|
||
@Override | ||
public void onFailure(Exception e) { | ||
exceptionList.add(e); | ||
logger.error(e.getMessage()); | ||
} | ||
|
||
public static Logger getLogger() { | ||
return logger; | ||
} | ||
|
||
public ArrayList<Exception> getExceptionList() { | ||
return exceptionList; | ||
} | ||
} |
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