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";
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) {
}
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;
}
}
+ @Override
+ public boolean isMessageValid(String message) {
+ return true;
+ }
+
/*
* Create a consumer by specifying properties containing information such as topic name, timeout, URL etc
*/
--- /dev/null
+/*
+ * ============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);
+
+}