/** * Retrieve connection factory from JNDI * * @param jmsConfig * @param jndiConfig * @return */ private ConnectionFactory getConnectionFactoryFromJndi() { if (getJndiEnvironment() == null || getConnectionFactoryName() == null) { return null; } try { return new JndiHelper(getJndiEnvironment()). lookup(getConnectionFactoryName(), ConnectionFactory.class); } catch (NamingException e) { throw new RuntimeException(e); } }
private void configureJndi(JMSConfiguration jmsConfiguration) { final Configuration cfg = configuration == null ? CallContext.resolveConfiguration(serviceName) : configuration; final String jndiConnectionFactoryName = getJndiProperty("jndiConnectionFactoryName"); if (jndiConnectionFactoryName != null) { jmsConfiguration.setConnectionFactoryName(jndiConnectionFactoryName); } final String connectionUserName = getJndiProperty("connectionUserName"); if (connectionUserName != null) { jmsConfiguration.setUserName(connectionUserName); } final String connectionPassword = getJndiProperty("connectionPassword"); if (connectionPassword != null) { jmsConfiguration.setPassword(connectionPassword); } Properties env = jmsConfiguration.getJndiEnvironment(); final boolean hasNoEnv = env == null; if (hasNoEnv) { env = new Properties(); } cfg.fillProperties("jndiConfig.environment", env); if (workPrefix != null) { cfg.fillProperties(workPrefix + "jndiConfig.environment", env); } if (hasNoEnv && !env.isEmpty()) { jmsConfiguration.setJndiEnvironment(env); } }
container.setExecutor((Executor) executor); container.setJndiEnvironment(jmsConfig.getJndiEnvironment()); container.start(); suspendedContinuations.setListenerContainer(container);