diff options
author | Lee, Tian (tl5884) <TianL@amdocs.com> | 2018-07-10 15:03:19 +0100 |
---|---|---|
committer | sunil unnava <su622b@att.com> | 2018-07-23 18:01:40 +0000 |
commit | edeee1d6e9fd857c8fb9b8622633fee43efb00e2 (patch) | |
tree | 2f51c177883cd164b4aeaeb382990324989cda20 /src/main/java | |
parent | 1f70b26884ba61f466eac21635eae125acd29a1f (diff) |
Fix bug with host failover functionality
DMaaP client does not failover to next configured host when the current
host returns an error status during event consumption.
Change-Id: I117ab993c3badea819876943e446d9ab45fd2db8
Issue-ID: DMAAP-541
Signed-off-by: Lee, Tian (tl5884) <TianL@amdocs.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java b/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java index 4f5907f..72d97c9 100644 --- a/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java +++ b/src/main/java/com/att/nsa/mr/client/impl/MRConsumerImpl.java @@ -41,6 +41,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Properties; +import java.util.concurrent.TimeUnit; import org.apache.http.HttpException; import org.apache.http.HttpStatus; import org.json.JSONArray; @@ -352,6 +353,13 @@ public class MRConsumerImpl extends MRBaseClient implements MRConsumer { return mrConsumerResponse; } + @Override + protected void reportProblemWithResponse() { + log.warn("There was a problem with the server response. Blacklisting for 3 minutes."); + super.reportProblemWithResponse(); + fHostSelector.reportReachabilityProblem(3, TimeUnit.MINUTES); + } + private void createMRConsumerResponse(String reply, MRConsumerResponse mrConsumerResponse) { if (reply.startsWith("{")) { JSONObject jObject = new JSONObject(reply); |