@Override
public void onMessage(PluginNotificationMessage message) {
HealthStateScope scope = HealthStateScope.aboutPlugin(message.pluginId());
try {
LOGGER.debug("Sending {} notification message {} for plugin {}", message.getRequestName(), message, message.pluginId());
Result result = notificationExtension.notify(message.pluginId(), message.getRequestName(), message.getData());
if (result.isSuccessful()) {
serverHealthService.removeByScope(scope);
LOGGER.debug("Successfully sent {} notification message {} for plugin {}", message.getRequestName(), message, message.pluginId());
} else {
String errorDescription = result.getMessages() == null ? null : StringUtils.join(result.getMessages(), ", ");
handlePluginNotifyError(message.pluginId(), scope, errorDescription, null);
}
} catch (Exception e) {
String errorDescription = e.getMessage() == null ? "Unknown error" : e.getMessage();
handlePluginNotifyError(message.pluginId(), scope, errorDescription, e);
}
}