Remove policies from repository when Ric is removed from configuration
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / dmaap / DmaapMessageConsumer.java
index 91f9ff2..46dd2ee 100644 (file)
@@ -2,7 +2,7 @@
  * ========================LICENSE_START=================================
  * O-RAN-SC
  * %%
- * Copyright (C) 2019 Nordix Foundation
+ * Copyright (C) 2020 Nordix Foundation
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ package org.oransc.policyagent.dmaap;
 
 import com.google.common.collect.Iterables;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.time.Duration;
 import java.util.Properties;
@@ -45,7 +44,9 @@ public class DmaapMessageConsumer implements Runnable {
 
     private static final Logger logger = LoggerFactory.getLogger(DmaapMessageConsumer.class);
 
+    @SuppressWarnings("squid:S00116") // To avoid warning about DMAAP abbreviation.
     final Duration TIME_BETWEEN_DMAAP_POLLS = Duration.ofSeconds(10);
+
     private final ApplicationConfig applicationConfig;
 
     @Value("${server.port}")
@@ -83,7 +84,7 @@ public class DmaapMessageConsumer implements Runnable {
         }
     }
 
-    private Iterable<String> fetchAllMessages() throws ServiceException, FileNotFoundException, IOException {
+    private Iterable<String> fetchAllMessages() throws ServiceException, IOException {
         Properties dmaapConsumerProperties = this.applicationConfig.getDmaapConsumerConfig();
         MRConsumer consumer = MRClientFactory.createConsumer(dmaapConsumerProperties);
         MRConsumerResponse response = consumer.fetchWithReturnConsumerResponse();
@@ -95,18 +96,18 @@ public class DmaapMessageConsumer implements Runnable {
         }
     }
 
-    private void processMsg(String msg) throws Exception {
+    private void processMsg(String msg) throws IOException {
         logger.debug("Message Reveived from DMAAP : {}", msg);
         createDmaapMessageHandler().handleDmaapMsg(msg);
     }
 
-    private DmaapMessageHandler createDmaapMessageHandler() throws FileNotFoundException, IOException {
+    private DmaapMessageHandler createDmaapMessageHandler() throws IOException {
         String agentBaseUrl = "http://localhost:" + this.localServerPort;
         AsyncRestClient agentClient = new AsyncRestClient(agentBaseUrl);
         Properties dmaapPublisherProperties = applicationConfig.getDmaapPublisherConfig();
         MRBatchingPublisher producer = MRClientFactory.createBatchingPublisher(dmaapPublisherProperties);
 
-        return new DmaapMessageHandler(producer, this.applicationConfig, agentClient);
+        return new DmaapMessageHandler(producer, agentClient);
     }
 
     private boolean sleep(Duration duration) {