Hi Everyone,
I created UiNotificationEvent in global module by extending GlobalApplicationEvent and implementing GlobalUiEvent.
When the middleware receive entitychangedevent i am sending the UiNotification Event. I dont see the event receiving the UI controller. Is there any additional settings or environment update i need to add for send/receive global events across layers.
Below is my code:
@EventListener
public void beforeCommit(EntityChangedEvent<Submission, Long> event) {
Id<Submission, Long> entityId = event.getEntityId();
EntityChangedEvent.Type changeType = event.getType();
AttributeChanges changes = event.getChanges();
System.out.println("before commit event"+changes.getAttributes().iterator().next().toString());
String message = "Received commit changes from middle layer";
// globaleventservice.sendEvent(new UiNotificationEvent(this, Strings.isNullOrEmpty(message) ? "test" : message));
events.publish(new UiNotificationEvent(this, Strings.isNullOrEmpty(message) ? "test" : message));
}
UI Controller Listener –
@EventListener
public void onUiNotificationEvent(UiNotificationEvent event) {
System.out.println("Received {}"+ event.getMessage());
if(submissionDc.getItem() != null) {
dataManager.reload(submissionDc.getItem(), "submission-view");
}else{
System.out.println("current item is null in uinotification event");
}
}
Please help me in resolving the issue.
Thanks in advance for the help