use of fish.payara.notification.healthcheck.HealthCheckNotificationData in project Payara by payara.
the class CDIEventbusNotificationEventFactory method buildNotificationEvent.
@Override
public CDIEventbusNotificationEvent buildNotificationEvent(String name, List<HealthCheckResultEntry> entries, Level level) {
CDIEventbusNotificationEvent notificationEvent = initializeEvent(createEventInstance());
notificationEvent.setSubject(getSubject(level));
String messageFormatted = getMessageFormatted(new Object[] { name, getCumulativeMessages(entries) });
if (messageFormatted != null) {
notificationEvent.setMessage(messageFormatted);
}
notificationEvent.setNotificationData(new HealthCheckNotificationData(entries));
return notificationEvent;
}
use of fish.payara.notification.healthcheck.HealthCheckNotificationData in project Payara by payara.
the class EventbusNotificationEventFactory method buildNotificationEvent.
@Override
public EventbusNotificationEvent buildNotificationEvent(String name, List<HealthCheckResultEntry> entries, Level level) {
EventbusNotificationEvent notificationEvent = initializeEvent(createEventInstance());
notificationEvent.setSubject(getSubject(level));
String messageFormatted = getMessageFormatted(new Object[] { name, getCumulativeMessages(entries) });
if (messageFormatted != null) {
notificationEvent.setMessage(messageFormatted);
}
notificationEvent.setNotificationData(new HealthCheckNotificationData(entries));
notificationEvent.setInstanceName(hazelcast.getUUID());
return notificationEvent;
}
use of fish.payara.notification.healthcheck.HealthCheckNotificationData in project Payara by payara.
the class BaseHealthCheck method sendNotification.
/**
* Sends a notification to all notifier enabled with the healthcheck service.
* <p>
* @param checkResult information collected by the regarding health check service
* @param level Level of the message to send
* @param name Name of the checker executed
*/
public void sendNotification(String name, HealthCheckResult checkResult, Level level) {
String message = "{0}:{1}";
String subject = "Health Check notification with severity level: " + level.getName();
String messageFormatted = getMessageFormatted(new Object[] { name, getCumulativeMessages(checkResult.getEntries()) });
Collection<String> enabledNotifiers = healthCheckService.getEnabledNotifiers();
PayaraNotification notification = notificationFactory.newBuilder().whitelist(enabledNotifiers.toArray(new String[0])).subject(name).message(messageFormatted).data(new HealthCheckNotificationData(checkResult.getEntries())).eventType(level.getName()).build();
notificationEventBus.publish(notification);
if (healthCheckService.isHistoricalTraceEnabled()) {
healthCheckEventStore.addTrace(new Date().getTime(), level, subject, message, new Object[] { name, checkResult.getEntries().toString() });
}
}
Aggregations