List of usage examples for javax.jms QueueReceiver close
void close() throws JMSException;
From source file:nl.nn.adapterframework.extensions.ifsa.jms.PullingIfsaProviderListener.java
protected void releaseReceiver(QueueReceiver receiver) throws ListenerException { if (isSessionsArePooled() && receiver != null) { try {//from ww w . j a v a 2 s. c o m receiver.close(); // do not write to log, this occurs too often } catch (Exception e) { throw new ListenerException(getLogPrefix() + "exception closing QueueReceiver", e); } } }
From source file:org.grouter.common.jms.QueueSenderDestination.java
/** * <b>See documentation in {@link org.grouter.common.jms.AbstractSenderDestination#waitAndGetReplyFromTemporaryDestination(long)}.</b><br> * <br>/*from w ww.ja v a 2 s.co m*/ */ public Message waitAndGetReplyFromTemporaryDestination(long waitForMs) { QueueReceiver receiver = null; try { if (!useTemporaryReplyDestination) { throw new IllegalStateException("You have used this destination in a wrong way. Have you " + "used correct constructor for temporary destinations? Use constructor" + "where you indicate that you should be using a temporary Q. "); } receiver = queueSession.createReceiver(getTemporaryQueue()); return receiver.receive(waitForMs); } catch (JMSException ex) { logger.warn("Waiting for reply on temp queue failed", ex); return null; } finally { if (receiver != null) { try { receiver.close(); } catch (Exception ex1) { //ignore } } } }
From source file:org.smartfrog.avalanche.shared.jms.MessageListener.java
public MonitoringEvent receive() throws Exception { MonitoringEvent event = null;/*from w w w . ja v a 2 s . co m*/ // TODO : no need to open a new session every time .. fix it QueueSession qs = null; QueueReceiver qr = null; try { qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); qr = qs.createReceiver(queue); // TODO : Fix message timeout log.info("MonitoringEvent.receive() : Checking for new message on Queue"); MapMessage mm = (MapMessage) qr.receive(jmsTimeout); if (mm != null) { log.info("Message received"); event = new MonitoringEventDefaultImpl(); event.setHost(mm.getString(MonitoringEvent.HOST)); event.setInstanceName(mm.getString(MonitoringEvent.INSTANCE_NAME)); event.setModuleId(mm.getString(MonitoringEvent.MODULEID)); event.setModuleState(mm.getString(MonitoringEvent.MODULE_STATE)); event.setMsg(mm.getString(MonitoringEvent.MODULE_STATE)); event.setMessageType(mm.getInt(MonitoringEvent.MESSAGE_TYPE)); log.info("MessageListener.receive() - " + event); } else { log.info("No message found in queue"); } return event; } finally { qr.close(); qs.close(); } }