List of usage examples for org.springframework.jms.core JmsTemplate browse
@Override @Nullable public <T> T browse(BrowserCallback<T> action) throws JmsException
From source file:se.inera.intyg.rehabstod.service.monitoring.HealthCheckServiceImpl.java
private HealthStatus checkQueueDepth(JmsTemplate tpl) { long queueDepth = 0; boolean status = false; try {//from ww w .j ava 2s .c o m queueDepth = tpl.browse((session, browser) -> { Enumeration<?> enumeration = browser.getEnumeration(); long qd = 0; while (enumeration.hasMoreElements()) { enumeration.nextElement(); qd++; } return qd; }); status = true; } catch (Exception e) { LOG.warn("Error when checking queue depth", e); queueDepth = BAD_HEALTHSTATUS_MEASUREMNET; } return new HealthStatus(queueDepth, status); }