Update the license for 2017-2018 license
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / dmaap / AAIDmaapEventJMSConsumer.java
index d538998..cc3afa6 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
 package org.onap.aai.dmaap;
 
@@ -104,7 +102,16 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
                                        eventName = jo.getString("event-topic");
                                }
 
+                               MDC.put ("targetEntity", "DMAAP");
+                               if (jo.getString("event-topic") != null) {
+                                       eventName = jo.getString("event-topic");
+                                       MDC.put ("targetServiceName", eventName);
+                               }
+                               MDC.put ("serviceName", "AAI");
+                               MDC.put(LoggingField.STATUS_CODE.toString(), StatusCode.COMPLETE.toString());
+                               MDC.put(LoggingField.RESPONSE_CODE.toString(), "0");
                                LOGGER.info(eventName + "|" + aaiEvent);
+
                                if ("AAI-EVENT".equals(eventName)) {
                                        this.sentWithHttp(this.httpClient, this.aaiEventUrl, aaiEvent);
                                } else {
@@ -113,13 +120,21 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
                                }
                        } catch (java.net.SocketException e) {
                                if (!e.getMessage().contains("Connection reset")) {
+                                       MDC.put(LoggingField.STATUS_CODE.toString(), StatusCode.ERROR.toString());
+                                       MDC.put(LoggingField.RESPONSE_CODE.toString(), "200");
                                        LOGGER.error("AAI_7304 Error reaching DMaaP to send event. " + aaiEvent, e);
                                }
                        } catch (IOException e) {
+                               MDC.put(LoggingField.STATUS_CODE.toString(), StatusCode.ERROR.toString());
+                               MDC.put(LoggingField.RESPONSE_CODE.toString(), "200");
                                LOGGER.error("AAI_7304 Error reaching DMaaP to send event. " + aaiEvent, e);
                        } catch (JMSException | JSONException e) {
+                               MDC.put(LoggingField.STATUS_CODE.toString(), StatusCode.ERROR.toString());
+                               MDC.put(LoggingField.RESPONSE_CODE.toString(), "200");
                                LOGGER.error("AAI_7350 Error parsing aaievent jsm message for sending to dmaap. " + jsmMessageTxt, e);
                        } catch (Exception e) {
+                               MDC.put(LoggingField.STATUS_CODE.toString(), StatusCode.ERROR.toString());
+                               MDC.put(LoggingField.RESPONSE_CODE.toString(), "200");
                                LOGGER.error("AAI_7350 Error sending message to dmaap. " + jsmMessageTxt, e);
                        }
                }