improved check events subscribed in the config

This commit is contained in:
Francesco Mangiacrapa 2024-04-15 17:46:49 +02:00
parent 0417e471ac
commit 62a4a78d4f
2 changed files with 13 additions and 2 deletions

View File

@ -275,6 +275,12 @@ public class CatalogueBindingPlugin extends AbstractPlugin implements EventListe
List<Event> listEvents = eventsSub.getListEventSubscribed();
log.info("List events is {}", listEvents);
if(listEvents==null) {
log.info("no event subscribed, returing false");
return false;
}
if (listEvents.contains(observerd.getEvent())) {
log.info("the event {} is subscribed from config ", observerd.getEvent());
return true;

View File

@ -201,8 +201,13 @@ public class NotificationsPlugin extends AbstractPlugin implements EventListener
List<SubscribeNotificationEvent> listEvents = eventsSub.getListNotificationEventSubscribed();
log.info("List events is {}", listEvents);
if (listEvents != null
&& listEvents.stream().anyMatch(sne -> sne.getEvent().equals(observerd.getEvent()))) {
if(listEvents==null) {
log.info("no event subscribed, returning false");
return false;
}
if (listEvents.stream().anyMatch(sne -> sne.getEvent().equals(observerd.getEvent()))) {
log.info("the event {} is subscribed from config ", observerd.getEvent());
return true;
}