X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-node%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fnode%2FDeliveryTask.java;h=80729905a3e9f3ee1e926d8ac96c68de06486bce;hb=ee6fa61e2cd7df99891092709765235b6166a041;hp=7e10d5a0ce64ec3f1c3ec43cb4749438eae2a0a2;hpb=9d8f44daae28d5a9c8113be7f280090b950b859e;p=dmaap%2Fdatarouter.git diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java index 7e10d5a0..80729905 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java @@ -28,7 +28,13 @@ import java.io.*; import java.net.*; import java.util.*; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.log4j.Logger; +import org.onap.dmaap.datarouter.node.eelf.EelfMsgs; +import org.slf4j.MDC; + +import static com.att.eelf.configuration.Configuration.*; /** * A file to be delivered to a destination. @@ -39,6 +45,8 @@ import org.apache.log4j.Logger; */ public class DeliveryTask implements Runnable, Comparable { private static Logger loggerDeliveryTask = Logger.getLogger("org.onap.dmaap.datarouter.node.DeliveryTask"); + private static EELFLogger eelflogger = EELFManager.getInstance() + .getLogger(DeliveryTask.class); private DeliveryTaskHelper dth; private String pubid; private DestInfo di; @@ -55,6 +63,7 @@ public class DeliveryTask implements Runnable, Comparable { private String subid; private int attempts; private String[][] hdrs; + private String newInvocationId; /** @@ -84,6 +93,7 @@ public class DeliveryTask implements Runnable, Comparable { String s = br.readLine(); int i = s.indexOf('\t'); method = s.substring(0, i); + NodeUtils.setIpAndFqdnForEelf(method); if (!"DELETE".equals(method) && !monly) { length = datafile.length(); } @@ -92,7 +102,7 @@ public class DeliveryTask implements Runnable, Comparable { i = s.indexOf('\t'); String h = s.substring(0, i); String v = s.substring(i + 1); - if ("x-att-dr-routing".equalsIgnoreCase(h)) { + if ("x-dmaap-dr-routing".equalsIgnoreCase(h)) { subid = v.replaceAll("[^ ]*/", ""); feedid = dth.getFeedId(subid.replaceAll(" .*", "")); } @@ -102,6 +112,14 @@ public class DeliveryTask implements Runnable, Comparable { if (h.equalsIgnoreCase("content-type")) { ctype = v; } + if (h.equalsIgnoreCase("x-onap-requestid")) { + MDC.put(MDC_KEY_REQUEST_ID, v); + } + if (h.equalsIgnoreCase("x-invocationid")) { + MDC.put("InvocationId", v); + v = UUID.randomUUID().toString(); + newInvocationId = v; + } hdrv.add(new String[]{h, v}); } } catch (Exception e) { @@ -169,7 +187,7 @@ public class DeliveryTask implements Runnable, Comparable { uc.setRequestMethod(method); uc.setRequestProperty("Content-Length", Long.toString(length)); uc.setRequestProperty("Authorization", di.getAuth()); - uc.setRequestProperty("X-ATT-DR-PUBLISH-ID", pubid); + uc.setRequestProperty("X-DMAAP-DR-PUBLISH-ID", pubid); for (String[] nv : hdrs) { uc.addRequestProperty(nv[0], nv[1]); } @@ -226,7 +244,7 @@ public class DeliveryTask implements Runnable, Comparable { InputStream is; if (rc >= 200 && rc <= 299) { is = uc.getInputStream(); - xpubid = uc.getHeaderField("X-ATT-DR-PUBLISH-ID"); + xpubid = uc.getHeaderField("X-DMAAP-DR-PUBLISH-ID"); } else { if (rc >= 300 && rc <= 399) { rmsg = uc.getHeaderField("Location"); @@ -252,6 +270,8 @@ public class DeliveryTask implements Runnable, Comparable { public void clean() { datafile.delete(); metafile.delete(); + eelflogger.info(EelfMsgs.INVOKE, newInvocationId); + eelflogger.info(EelfMsgs.EXIT); hdrs = null; }