Custom Notifiers

You can add your own Notifiers by adding Spring Beans which implement the Notifier interface, at best by extending AbstractEventNotifier or AbstractStatusChangeNotifier.

public class CustomNotifier extends AbstractEventNotifier {

        private static final Logger LOGGER = LoggerFactory.getLogger(LoggingNotifier.class);

        public CustomNotifier(InstanceRepository repository) {
                super(repository);
        }

        @Override
        protected Mono<Void> doNotify(InstanceEvent event, Instance instance) {
                return Mono.fromRunnable(() -> {
                        if (event instanceof InstanceStatusChangedEvent) {
                                LOGGER.info("Instance {} ({}) is {}", instance.getRegistration().getName(), event.getInstance(),
                                                ((InstanceStatusChangedEvent) event).getStatusInfo().getStatus());
                        }
                        else {
                                LOGGER.info("Instance {} ({}) {}", instance.getRegistration().getName(), event.getInstance(),
                                                event.getType());
                        }
                });
        }

}