Search in sources :

Example 1 with MonitorEventBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEventBuilder in project genius by opendaylight.

the class AlivenessMonitor method publishNotification.

void publishNotification(final Long monitorId, final LivenessState state) {
    LOG.debug("Sending notification for id {}  - state {}", monitorId, state);
    EventData data = new EventDataBuilder().setMonitorId(monitorId).setMonitorState(state).build();
    MonitorEvent event = new MonitorEventBuilder().setEventData(data).build();
    final ListenableFuture<?> eventFuture = notificationPublishService.offerNotification(event);
    Futures.addCallback(eventFuture, new FutureCallback<Object>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.warn("Error in notifying listeners for id {} - state {}", monitorId, state, error);
        }

        @Override
        public void onSuccess(Object arg) {
            LOG.trace("Successful in notifying listeners for id {} - state {}", monitorId, state);
        }
    }, callbackExecutorService);
}
Also used : MonitorEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEvent) EventDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.event.EventDataBuilder) MonitorEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEventBuilder) EventData(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.event.EventData)

Aggregations

MonitorEvent (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEvent)1 MonitorEventBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEventBuilder)1 EventData (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.event.EventData)1 EventDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.event.EventDataBuilder)1