aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
diff options
context:
space:
mode:
authorsu622b <sunil.unnava@att.com>2018-04-09 18:51:28 -0400
committersu622b <sunil.unnava@att.com>2018-04-09 18:51:45 -0400
commit37b7b57fc51f25079b13a016945e5e1f318dc361 (patch)
treeae1c90222297eaad8998987921cbb2dda133d8de /src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
parent20f5a4a523b284437dc7f76d2bc012ebb4cd669b (diff)
Support for post without authv1.1.5
Issue-ID: DMAAP-399 Change-Id: I51f1ff8ed978e3e00fccd63edf421c794f6e7f32 Signed-off-by: su622b <sunil.unnava@att.com>
Diffstat (limited to 'src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java')
-rw-r--r--src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java b/src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
index 6e1154f..c034e4f 100644
--- a/src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
+++ b/src/main/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisher.java
@@ -377,6 +377,23 @@ public class MRSimplerBatchPublisher extends MRBaseClient implements MRBatchingP
fPending.clear();
return true;
}
+
+ if (ProtocolTypeConstants.HTTPNOAUTH.getValue().equalsIgnoreCase(protocolFlag)) {
+ getLog().info("sending " + fPending.size() + " msgs to " + httpurl + ". Oldest: "
+ + (nowMs - fPending.peek().timestamp) + " ms");
+ final JSONObject result = postNoAuth(httpurl, baseStream.toByteArray(), contentType);
+
+ // Here we are checking for error response. If HTTP status
+ // code is not within the http success response code
+ // then we consider this as error and return false
+ if (result.getInt("status") < 200 || result.getInt("status") > 299) {
+ return false;
+ }
+ final String logLine = "MR reply ok (" + (Clock.now() - startMs) + " ms):" + result.toString();
+ getLog().info(logLine);
+ fPending.clear();
+ return true;
+ }
} catch (IllegalArgumentException x) {
getLog().warn(x.getMessage(), x);
} catch (IOException x) {