public void tearDown() throws Exception { if (!isBroker08()) { _xaqueueConnection.close(); _queueConnection.close(); } super.tearDown(); }
/** Initialize standard actors */ public void init() throws Exception { if (!isBroker08()) { _queue = (Queue) getInitialContext().lookup(QUEUENAME); _queueFactory = getConnectionFactory(); _xaqueueConnection = _queueFactory.createXAQueueConnection("guest", "guest"); XAQueueSession session = _xaqueueConnection.createXAQueueSession(); _queueConnection = _queueFactory.createQueueConnection("guest", "guest"); _nonXASession = _queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE); init(session, _queue); } }
public static XAQueueConnection getXAQueueConnection(Properties props) throws IOException, NamingException, JMSException { String cnnFactoryName = props.getProperty(JNDI_XAQUEUE_CONECTION_NAME_PROPERTY); if (cnnFactoryName == null) { throw new IOException( "You must set the property " + JNDI_XAQUEUE_CONECTION_NAME_PROPERTY + "in the JNDI property file"); } Context ctx = new InitialContext(props); XAQueueConnectionFactory qcf = (XAQueueConnectionFactory) lookupObject(ctx, cnnFactoryName); XAQueueConnection cnn; String username = (String) props.get("username"); if (username != null) { String password = (String) props.get("password"); cnn = qcf.createXAQueueConnection(username, password); } else { cnn = qcf.createXAQueueConnection(); } cnn.start(); return cnn; }