aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java18
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgValidator.java25
2 files changed, 36 insertions, 7 deletions
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java
index 4dcbfbb3e..015e3ada1 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerImpl.java
@@ -19,20 +19,15 @@
package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl;
-import java.util.List;
import java.util.Properties;
-import java.util.function.Consumer;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
import org.onap.dmaap.mr.client.MRClientFactory;
import org.onap.dmaap.mr.client.MRConsumer;
import org.onap.dmaap.mr.client.response.MRConsumerResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
+public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer, DMaaPVESMsgValidator {
private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerImpl.class);
private static final String DEFAULT_SDNRUSER = "admin";
@@ -68,7 +63,9 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
for (String msg : consumerResponse.getActualMessages()) {
noData = false;
LOG.debug("{} received ActualMessage from DMaaP VES Message topic {}", name,msg);
- processMsg(msg);
+ if(isMessageValid(msg)) {
+ processMsg(msg);
+ }
}
if (noData) {
@@ -81,6 +78,8 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
}
pauseThread();
}
+ } catch (JsonProcessingException jsonProcessingException) {
+ LOG.warn("Failed to convert message to JsonNode: {}", jsonProcessingException.getMessage());
} catch (Exception e) {
LOG.error("Caught exception reading from DMaaP VES Message Topic", e);
running = false;
@@ -89,6 +88,11 @@ public abstract class DMaaPVESMsgConsumerImpl implements DMaaPVESMsgConsumer {
}
}
+ @Override
+ public boolean isMessageValid(String message) {
+ return true;
+ }
+
/*
* Create a consumer by specifying properties containing information such as topic name, timeout, URL etc
*/
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgValidator.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgValidator.java
new file mode 100644
index 000000000..0532334ef
--- /dev/null
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgValidator.java
@@ -0,0 +1,25 @@
+/*
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt mountpoint-registrar
+ * =================================================================================================
+ * Copyright (C) 2021 Samsung Electronics 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. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ * ============LICENSE_END==========================================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl;
+
+public interface DMaaPVESMsgValidator {
+
+ boolean isMessageValid(String message);
+
+}