@Override protected void processAccountingEvent(Class<?> source, AccountingEvent event) { if (event instanceof BergamotAccountingEvent) { try { this.producer.publish((BergamotAccountingEvent) event); } catch (Exception e) { logger.error("Failed to enqueue accounting event: " + event.getClass() + " " + event.toString()); } } } }
private void joinHealthCheckCluster() { // send a join message this.healthcheckProducer.publish(new HealthCheckJoin(this.instanceId, this.runtimeId, this.daemonName, this.startedAt, this.hostId, this.hostName)); }
private void unjoinHealthCheckCluster() { // send a join message this.healthcheckProducer.publish(new HealthCheckUnjoin(this.instanceId, this.daemonName)); }
private void sendHeartbeat() { this.healthcheckProducer.publish(new HealthCheckHeartbeat(this.instanceId, System.currentTimeMillis(), this.nextHeartbeatSequence())); }
@Override public void start() throws Exception { // open the queue this.controlQueue = ControlQueue.open(); this.watcherQueue = WatcherQueue.open(); this.workerQueue = WorkerQueue.open(); // control this.controlEventProducer = this.controlQueue.publishControlEvents(); // watcher this.watcherEventConsumer = this.watcherQueue.consumeWatcherEvents(this, this.getWatcher().getId(), this.getName()); // results this.resultProducer = this.workerQueue.publishResults(); // start the executors for (Executor<?> ex : this.getExecutors()) { ex.start(); } // register with the controller this.controlEventProducer.publish(new RegisterWatcher(this.getWatcher().getId(), this.getName(), this.getWatcher().getSite(), this.getWatcher().getLocation())); }