Add webconfig for dmaap/rapp rest client
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / tasks / RicSynchronizationTask.java
index 42d9ab6..6ae55c4 100644 (file)
@@ -134,7 +134,7 @@ public class RicSynchronizationTask {
     private void notifyAllServices(String body) {
         for (Service service : services.getAll()) {
             String url = service.getCallbackUrl();
-            if (service.getCallbackUrl().length() > 0) {
+            if (url.length() > 0) {
                 createNotificationClient(url) //
                     .put("", body) //
                     .subscribe( //
@@ -160,7 +160,7 @@ public class RicSynchronizationTask {
     }
 
     AsyncRestClient createNotificationClient(final String url) {
-        return new AsyncRestClient(url);
+        return new AsyncRestClient(url, this.a1ClientFactory.getAppConfig().getWebClientConfig());
     }
 
     private Flux<PolicyType> synchronizePolicyTypes(Ric ric, A1Client a1Client) {
@@ -198,8 +198,16 @@ public class RicSynchronizationTask {
             .flatMapMany(notUsed -> Flux.just(policy));
     }
 
+    private boolean checkTransient(Policy policy) {
+        if (policy.isTransient()) {
+            this.policies.remove(policy);
+        }
+        return policy.isTransient();
+    }
+
     private Flux<Policy> recreateAllPoliciesInRic(Ric ric, A1Client a1Client) {
         return Flux.fromIterable(policies.getForRic(ric.name())) //
+            .filter(policy -> !checkTransient(policy)) //
             .flatMap(policy -> putPolicy(policy, ric, a1Client), CONCURRENCY_RIC);
     }