summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main/java/org
diff options
context:
space:
mode:
authorPriyank Maheshwari <priyank.maheshwari@est.tech>2023-05-30 10:24:25 +0000
committerGerrit Code Review <gerrit@onap.org>2023-05-30 10:24:25 +0000
commitd123807549a7f4670ecd273641c46ed101f62893 (patch)
tree924e3595e81131b9709693629965eb1513f63cc4 /cps-ncmp-service/src/main/java/org
parent325ac091ddea291c5659fa6e803f132a578deb14 (diff)
parent1f6008f39921246db95ce4d8a33d5474b658a203 (diff)
Merge "Improve error scenarios SubscriptionEventForwarder"
Diffstat (limited to 'cps-ncmp-service/src/main/java/org')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/avcsubscription/SubscriptionEventForwarder.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/avcsubscription/SubscriptionEventForwarder.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/avcsubscription/SubscriptionEventForwarder.java
index 4afa051d30..4654b148c6 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/avcsubscription/SubscriptionEventForwarder.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/avcsubscription/SubscriptionEventForwarder.java
@@ -56,7 +56,8 @@ public class SubscriptionEventForwarder {
private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
- private static final String DMI_AVC_SUBSCRIPTION_TOPIC_PREFIX = "ncmp-dmi-cm-avc-subscription-";
+ @Value("${app.ncmp.avc.subscription-forward-topic-prefix}")
+ private String dmiAvcSubscriptionTopicPrefix;
@Value("${ncmp.timers.subscription-forwarding.dmi-response-timeout-ms:30000}")
private int dmiResponseTimeoutInMs;
@@ -82,8 +83,15 @@ public class SubscriptionEventForwarder {
= DmiServiceNameOrganizer.getDmiPropertiesPerCmHandleIdPerServiceName(yangModelCmHandles);
final Set<String> dmisToRespond = new HashSet<>(dmiPropertiesPerCmHandleIdPerServiceName.keySet());
- startResponseTimeout(subscriptionEvent, dmisToRespond);
- forwardEventToDmis(dmiPropertiesPerCmHandleIdPerServiceName, subscriptionEvent);
+ if (dmisToRespond.isEmpty()) {
+ log.info("placeholder to create full outcome response for subscriptionEventId: {}.",
+ subscriptionEvent.getEvent().getSubscription().getClientID()
+ + subscriptionEvent.getEvent().getSubscription().getName());
+ //TODO outcome response with no cmhandles
+ } else {
+ startResponseTimeout(subscriptionEvent, dmisToRespond);
+ forwardEventToDmis(dmiPropertiesPerCmHandleIdPerServiceName, subscriptionEvent);
+ }
}
private void forwardEventToDmis(final Map<String, Map<String, Map<String, String>>> dmiNameCmHandleMap,
@@ -91,8 +99,8 @@ public class SubscriptionEventForwarder {
dmiNameCmHandleMap.forEach((dmiName, cmHandlePropertiesMap) -> {
subscriptionEvent.getEvent().getPredicates().setTargets(Collections.singletonList(cmHandlePropertiesMap));
final String eventKey = createEventKey(subscriptionEvent, dmiName);
- eventsPublisher.publishEvent(
- DMI_AVC_SUBSCRIPTION_TOPIC_PREFIX + dmiName, eventKey, subscriptionEvent);
+ final String dmiAvcSubscriptionTopic = dmiAvcSubscriptionTopicPrefix + dmiName;
+ eventsPublisher.publishEvent(dmiAvcSubscriptionTopic, eventKey, subscriptionEvent);
});
}