List of usage examples for javax.jms QueueConnection createSession
Session createSession(boolean transacted, int acknowledgeMode) throws JMSException;
From source file:pl.psnc.synat.wrdz.zu.certificate.CertificateChecker.java
/** * Notifies the system monitor that the given user has a certificate that's beyond the expiration threshold. * //from www .j a v a2 s . c o m * @param username * name of the user with the (nearly) expired certificate */ private void notifyExpirationCheckFail(String username) { QueueConnection connection = null; try { connection = queueConnectionFactory.createQueueConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); TextMessage message = session.createTextMessage(); message.setText(username); session.createProducer(certificateQueue).send(message); } catch (JMSException e) { logger.error("Sending message to the JMS queue failed", e); } finally { if (connection != null) { try { connection.close(); } catch (JMSException e) { logger.error("Error while closing a connection.", e); } } } }