- /**
- * Create an instance of Notification Subscriber.
- *
- * @param dataUpdatedEventNotificationEnabled notification can be enabled by setting
- * 'notification.data-updated.enabled=true' in application properties
- * @param notificationPublisher notification Publisher
- * @param cpsDataUpdatedEventFactory to create CPSDataUpdatedEvent
- * @param notificationErrorHandler error handler
- */
- @Autowired
- public NotificationService(
- @Value("${notification.data-updated.enabled}") final boolean dataUpdatedEventNotificationEnabled,
- final NotificationPublisher notificationPublisher,
- final CpsDataUpdatedEventFactory cpsDataUpdatedEventFactory,
- final NotificationErrorHandler notificationErrorHandler) {
- this.dataUpdatedEventNotificationEnabled = dataUpdatedEventNotificationEnabled;
- this.notificationPublisher = notificationPublisher;
- this.cpsDataUpdatedEventFactory = cpsDataUpdatedEventFactory;
- this.notificationErrorHandler = notificationErrorHandler;
+ @PostConstruct
+ public void init() {
+ log.info("Notification Properties {}", notificationProperties);
+ this.dataspacePatterns = getDataspaceFilterPatterns(notificationProperties);
+ }
+
+ private List<Pattern> getDataspaceFilterPatterns(final NotificationProperties notificationProperties) {
+ if (notificationProperties.isEnabled()) {
+ return Arrays.stream(notificationProperties.getFilters()
+ .getOrDefault("enabled-dataspaces", "")
+ .split(","))
+ .map(filterPattern -> Pattern.compile(filterPattern, Pattern.CASE_INSENSITIVE))
+ .collect(Collectors.toList());
+ } else {
+ return Collections.emptyList();
+ }