aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2024-05-07 15:33:19 +0100
committermpriyank <priyank.maheshwari@est.tech>2024-05-08 14:09:39 +0100
commitf7873bd1a65592539a26e49ba84cd3c90cdca252 (patch)
treeffa42b32da5db658176bb7181405e80defac7ef6 /cps-service/src/main
parent7b935fc1a85db39ffe216f6f53fed21de1bbb11a (diff)
Conditional cps change events
- introduced a parameter to control the cps core change event notifications. we should be able to disable these notifications without affecting other notification flows. - fixed the LayeredArchitectureTest as we are accessing the Anchor model in the events package now. Issue-ID: CPS-2213 Change-Id: Id875925bc14de1cc6e8fa3193c0df470e09fe43f Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-service/src/main')
-rw-r--r--cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsService.java b/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsService.java
index d38432dfa9..1097834880 100644
--- a/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsService.java
+++ b/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsService.java
@@ -46,6 +46,9 @@ public class CpsDataUpdateEventsService {
@Value("${app.cps.data-updated.topic:cps-data-updated-events}")
private String topicName;
+ @Value("${app.cps.data-updated.change-event-notifications-enabled:true}")
+ private boolean cpsChangeEventNotificationsEnabled;
+
@Value("${notification.enabled:false}")
private boolean notificationsEnabled;
@@ -60,7 +63,7 @@ public class CpsDataUpdateEventsService {
@Timed(value = "cps.dataupdate.events.publish", description = "Time taken to publish Data Update event")
public void publishCpsDataUpdateEvent(final Anchor anchor, final String xpath,
final Operation operation, final OffsetDateTime observedTimestamp) {
- if (notificationsEnabled) {
+ if (notificationsEnabled && cpsChangeEventNotificationsEnabled) {
final CpsDataUpdatedEvent cpsDataUpdatedEvent = createCpsDataUpdatedEvent(anchor,
observedTimestamp, xpath, operation);
final String updateEventId = anchor.getDataspaceName() + ":" + anchor.getName();
@@ -70,7 +73,8 @@ public class CpsDataUpdateEventsService {
.extensions(extensions).build().asCloudEvent();
eventsPublisher.publishCloudEvent(topicName, updateEventId, cpsDataUpdatedEventAsCloudEvent);
} else {
- log.debug("Notifications disabled.");
+ log.debug("State of Overall Notifications : {} and Cps Change Event Notifications : {}",
+ notificationsEnabled, cpsChangeEventNotificationsEnabled);
}
}