/** * Create a new instance that enable publishing notifications for the specified Collector instance. * * @param configuration * the Collector instance configuration details * @return the created instance * @throws NullPointerException * if the parameter is {@code null} */ public static NotificationPublisher newInstance(final CollectorConfiguration configuration) { checkNotNull(configuration,"Collector configuration cannot be null"); return new NotificationPublisher(configuration); }
public void shutdown() { this.executorService.shutdown(); if (this.publisher != null) { this.publisher.shutdown(); } }
notifications.setVirtualHost(virtualHost); this.publisher = NotificationPublisher.newInstance(amqpConfig); this.publisher.start();
/** * Method to send notification through the publisher adding timestamp and * instance information. * @param event Event to send. * @throws IOException when an I/O exception occurs. */ private void sendNotification(Event event) throws IOException { event.setTimestamp(System.currentTimeMillis()); event.setInstance(instance); publisher.publish(event); }