List of usage examples for javax.jms QueueConnectionFactory createConnection
Connection createConnection(String userName, String password) throws JMSException;
From source file:org.apache.synapse.message.store.impl.jms.JmsStore.java
/** * Creates a new JMS Connection.//from ww w .j a va 2 s. c o m * * @return A connection to the JMS Queue used as the store of this message store. * @throws JMSException */ public Connection newConnection() throws JMSException { Connection connection; if (connectionFactory == null) { logger.error(nameString() + ". Could not create a new connection to the broker." + " Initial Context Factory:[" + parameters.get(NAMING_FACTORY_INITIAL) + "]; Provider URL:[" + parameters.get(PROVIDER_URL) + "]; Connection Factory:[null]."); return null; } if (isVersion11) { if (userName != null && password != null) { connection = connectionFactory.createConnection(userName, password); } else { connection = connectionFactory.createConnection(); } } else { QueueConnectionFactory connectionFactory; connectionFactory = (QueueConnectionFactory) this.connectionFactory; if (userName != null && password != null) { connection = connectionFactory.createQueueConnection(userName, password); } else { connection = connectionFactory.createQueueConnection(); } } connection.start(); if (logger.isDebugEnabled()) { logger.debug(nameString() + ". Created JMS Connection."); } return connection; }