diff options
author | Renu Kumari <renu.kumari@bell.ca> | 2021-08-19 13:11:00 -0400 |
---|---|---|
committer | Renu Kumari <renu.kumari@bell.ca> | 2021-08-23 11:52:48 -0400 |
commit | 0c5979fe48a43d5fbc680d026ea7ec866f60ed9e (patch) | |
tree | d48e4f76cecfe7524e6cc4cc649c5e062b5b92e4 /cps-service/src/main/java/org/onap/cps/notification/NotificationService.java | |
parent | db89e9c72388a7eb0a2132f7c25a213a925a0478 (diff) |
Process data-updated event asynchronouslymr/526/123402/5
- notification is processed asynchronously using defined threadpool
- updated docker-compose and readme to add dataspace filtering variables
Issue-ID: CPS-526
Signed-off-by: Renu Kumari <renu.kumari@bell.ca>
Change-Id: I7f827250f45cb9e3db2f060e9b3a089a4eaee05c
Diffstat (limited to 'cps-service/src/main/java/org/onap/cps/notification/NotificationService.java')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/notification/NotificationService.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java b/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java index 9cb2c52e01..6aaecc5c1a 100644 --- a/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java +++ b/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java @@ -21,10 +21,13 @@ package org.onap.cps.notification; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Future; import java.util.regex.Pattern; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service @@ -51,6 +54,7 @@ public class NotificationService { final NotificationPublisher notificationPublisher, final CpsDataUpdatedEventFactory cpsDataUpdatedEventFactory, final NotificationErrorHandler notificationErrorHandler) { + log.debug("Notification Properties {}", notificationProperties); this.notificationProperties = notificationProperties; this.notificationPublisher = notificationPublisher; this.cpsDataUpdatedEventFactory = cpsDataUpdatedEventFactory; @@ -76,7 +80,8 @@ public class NotificationService { * @param dataspaceName dataspace name * @param anchorName anchor name */ - public void processDataUpdatedEvent(final String dataspaceName, final String anchorName) { + @Async("notificationExecutor") + public Future<Void> processDataUpdatedEvent(final String dataspaceName, final String anchorName) { log.debug("process data updated event for dataspace '{}' & anchor '{}'", dataspaceName, anchorName); try { if (shouldSendNotification(dataspaceName)) { @@ -92,6 +97,7 @@ public class NotificationService { notificationErrorHandler.onException("Failed to process cps-data-updated-event.", exception, dataspaceName, anchorName); } + return CompletableFuture.completedFuture(null); } /* |