/** * Access RabbitMQ object * @return singleton instance or null */ public static RabbitMQPublisher getInstance() { if (singleton == null) { RabbitMQPublisher publisher = new RabbitMQPublisher(); if (publisher.isConnected()) { singleton = publisher; } } return singleton; }
/** * Access RabbitMQ object * @return singleton instance or null */ public static RabbitMQPublisher getInstance() { if (singleton == null) { RabbitMQPublisher publisher = new RabbitMQPublisher(); if (publisher.isConnected()) { singleton = publisher; } } return singleton; }
/** * Access RabbitMQ object * @return singleton instance or null */ public static RabbitMQPublisher getInstance() { if (singleton == null) { RabbitMQPublisher publisher = new RabbitMQPublisher(); if (publisher.isConnected()) { singleton = publisher; } } return singleton; }
/** * Access RabbitMQ object * @return singleton instance or null */ public static RabbitMQPublisher getInstance() { if (singleton == null) { RabbitMQPublisher publisher = new RabbitMQPublisher(); if (publisher.isConnected()) { singleton = publisher; } } return singleton; }
@Override public void run() { try { // check the database connection whether it is alive if (new DbAccess().ping()) logger.trace("Health check: Database connection is alive"); else throw new Exception("Database is down"); // test whether we have live TCP connection to RabbitMQ listener if (RabbitMQListener.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Listener is alive"); else throw new Exception("RabbitMQ Listener is down"); // test our TCP connection to RabbitMQ Publisher if (RabbitMQPublisher.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Publisher is alive"); else throw new Exception("RabbitMQ Publisher is down"); // we passed all the tests HealthStatus.getInstance().setHealthy(); } catch (Exception e) { logger.trace(String.format("Health check: failed (%s)", e.getMessage())); // we couldn't access the InfluxDB HealthStatus.getInstance().setUnhealthy(e.getMessage()); } } }
@Override public void run() { try { // check the database connection whether it is alive if (new DbAccess().ping()) logger.trace("Health check: Database connection is alive"); else throw new Exception("Database is down"); // test whether we have live TCP connection to RabbitMQ listener if (RabbitMQListener.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Listener is alive"); else throw new Exception("RabbitMQ Listener is down"); // test our TCP connection to RabbitMQ Publisher if (RabbitMQPublisher.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Publisher is alive"); else throw new Exception("RabbitMQ Publisher is down"); // we passed all the tests HealthStatus.getInstance().setHealthy(); } catch (Exception e) { logger.trace(String.format("Health check: failed (%s)", e.getMessage())); // we couldn't access the InfluxDB HealthStatus.getInstance().setUnhealthy(e.getMessage()); } } }
@Override public void run() { try { // check the database connection whether it is alive if (new DbAccess().ping()) logger.trace("Health check: Database connection is alive"); else throw new Exception("Database is down"); // test whether we have live TCP connection to RabbitMQ listener if (RabbitMQListener.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Listener is alive"); else throw new Exception("RabbitMQ Listener is down"); // test our TCP connection to RabbitMQ Publisher if (RabbitMQPublisher.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Publisher is alive"); else throw new Exception("RabbitMQ Publisher is down"); // we passed all the tests HealthStatus.getInstance().setHealthy(); } catch (Exception e) { logger.trace(String.format("Health check: failed (%s)", e.getMessage())); // we couldn't access the InfluxDB HealthStatus.getInstance().setUnhealthy(e.getMessage()); } } }
@Override public void run() { try { // test database connection HibernateClient.getInstance().ping(); logger.trace("Health check: PostgreSQL is alive"); // test whether we have live TCP connection to RabbitMQ listener if (RabbitMQListener.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Listener is alive"); else throw new Exception("RabbitMQ Listener is down"); // test our TCP connection to RabbitMQ Publisher if (RabbitMQPublisher.getInstance().isConnected()) logger.trace("Health check: RabbitMQ Publisher is alive"); else throw new Exception("RabbitMQ Publisher is down"); // we passed all the tests HealthStatus.getInstance().setHealthy(); } catch (Exception e) { logger.trace(String.format("Health check: failed (%s)", e.getMessage())); // we couldn't access the InfluxDB HealthStatus.getInstance().setUnhealthy(e.getMessage()); } } }