You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2020/11/26 09:50:05 UTC

[nifi] branch main updated: NIFI-8048 PutElasticsearchRecord should retry with 503 response

This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 5ea18f3  NIFI-8048 PutElasticsearchRecord should retry with 503 response
5ea18f3 is described below

commit 5ea18f39b572b9c552ed066f32be08f14384452d
Author: Koji Kawamura <ij...@apache.org>
AuthorDate: Thu Nov 26 16:26:45 2020 +0900

    NIFI-8048 PutElasticsearchRecord should retry with 503 response
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #4690.
---
 .../main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java
index c383c8d..0973567 100644
--- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java
+++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticsearchError.java
@@ -36,7 +36,10 @@ public class ElasticsearchError extends RuntimeException {
 
     public ElasticsearchError(Exception ex) {
         super(ex);
-        isElastic = ELASTIC_ERROR_NAMES.contains(ex.getClass().getSimpleName());
+        final boolean isKnownException = ELASTIC_ERROR_NAMES.contains(ex.getClass().getSimpleName());
+        final boolean isServiceUnavailable = "ResponseException".equals(ex.getClass().getSimpleName())
+                && ex.getMessage().contains("503 Service Unavailable");
+        isElastic = isKnownException || isServiceUnavailable;
     }
 
     public boolean isElastic() {