diff options
author | 2024-04-24 16:22:49 +0000 | |
---|---|---|
committer | 2024-04-24 16:22:49 +0000 | |
commit | e90f0aa082e92b332f7bac7878be7f6576e722a3 (patch) | |
tree | 9702312a2c7e87d42982a4aa84c4d2cc23995130 /cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java | |
parent | 362d7f981d2060314d9cd152a8cace524ebda356 (diff) | |
parent | 2a1e5aac09411523e38fc7126b523ea4f6ac5f78 (diff) |
Merge "Reject create request with duplicated subscriptionId"
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java index 362fbeb9e..377e15531 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java @@ -23,12 +23,11 @@ package org.onap.cps.ncmp.api.impl.events.cmsubscription; import static org.onap.cps.ncmp.api.impl.events.mapper.CloudEventMapper.toTargetEvent; import io.cloudevents.CloudEvent; -import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.onap.cps.ncmp.api.impl.events.cmsubscription.service.CmNotificationSubscriptionHandlerService; import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.client_to_ncmp.CmNotificationSubscriptionNcmpInEvent; -import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.client_to_ncmp.Predicate; import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; @@ -38,7 +37,7 @@ import org.springframework.stereotype.Component; @RequiredArgsConstructor public class CmNotificationSubscriptionNcmpInEventConsumer { - private final DmiCmNotificationSubscriptionCacheHandler dmiCmNotificationSubscriptionCacheHandler; + private final CmNotificationSubscriptionHandlerService cmNotificationSubscriptionHandlerService; @Value("${notification.enabled:true}") private boolean notificationFeatureEnabled; @@ -56,12 +55,12 @@ public class CmNotificationSubscriptionNcmpInEventConsumer { toTargetEvent(cloudEvent, CmNotificationSubscriptionNcmpInEvent.class); log.info("Subscription with name {} to be mapped to hazelcast object...", cmNotificationSubscriptionNcmpInEvent.getData().getSubscriptionId()); + final String subscriptionId = cmNotificationSubscriptionNcmpInEvent.getData().getSubscriptionId(); - final List<Predicate> predicates = cmNotificationSubscriptionNcmpInEvent.getData().getPredicates(); - dmiCmNotificationSubscriptionCacheHandler.add(subscriptionId, predicates); - if ("subscriptionCreated".equals(cloudEvent.getType()) && cmNotificationSubscriptionNcmpInEvent != null) { - log.info("Subscription for ClientID {} with name {} ...", cloudEvent.getSource(), - cmNotificationSubscriptionNcmpInEvent.getData().getSubscriptionId()); + if ("subscriptionCreateRequest".equals(cloudEvent.getType())) { + log.info("Subscription for source {} with subscription id {} ...", cloudEvent.getSource(), subscriptionId); + cmNotificationSubscriptionHandlerService.processSubscriptionCreateRequest( + cmNotificationSubscriptionNcmpInEvent); } } }
\ No newline at end of file |