static ClientSessionFactory createClientSessionFactory(String host, int port) throws Exception { final Map<String, Object> properties = new HashMap<String, Object>(); properties.put("host", host); properties.put("port", port); final TransportConfiguration configuration = new TransportConfiguration(NettyConnectorFactory.class.getName(), properties); return HornetQClient.createServerLocatorWithoutHA(configuration).createSessionFactory(); }
protected void initDefaults() { if (locator == null) { locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName())); } if (sessionFactory == null) { try { sessionFactory = locator.createSessionFactory(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } if (consumerSessionFactory == null) consumerSessionFactory = sessionFactory; if (timeoutTask == null) throw new RuntimeException("TimeoutTask is not set"); }
/** * * @deprecated use {@link ServerLocator#createSessionFactory()} * @return */ @Deprecated public ClientSessionFactory getCoreFactory() throws JMSException { try { return serverLocator.createSessionFactory(); } catch (Exception e) { JMSException ex = new JMSException (e.getMessage()); ex.initCause(e); throw ex; } }
public XmlDataImporter(InputStream inputStream, String host, String port, boolean transactional) { try { reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); HashMap<String, Object> connectionParams = new HashMap<String, Object>(); connectionParams.put(TransportConstants.HOST_PROP_NAME, host); connectionParams.put(TransportConstants.PORT_PROP_NAME, port); ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams)); ClientSessionFactory sf = serverLocator.createSessionFactory(); session = sf.createSession(false, !transactional, true); managementSession = sf.createSession(false, true, true); localSession = true; } catch (Exception e) { e.printStackTrace(); } }
sf = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName())).createSessionFactory();
if (_startEmbedded) { _serverLocator = HornetQClient.createServerLocatorWithoutHA(getTransports(getConfiguration())); _clientSessionFactory = _serverLocator.createSessionFactory(); } else { _serverLocator = HornetQClient.createServerLocatorWithoutHA( new TransportConfiguration(NettyConnectorFactory.class.getName(), _transportParams)); _clientSessionFactory = _serverLocator.createSessionFactory();
ClientSessionFactory sf = serverLocator.createSessionFactory();
if (_startEmbedded) { _serverLocator = HornetQClient.createServerLocatorWithoutHA(getTransports(getConfiguration())); _clientSessionFactory = _serverLocator.createSessionFactory(); } else { _serverLocator = HornetQClient.createServerLocatorWithoutHA( new TransportConfiguration(NettyConnectorFactory.class.getName(), _transportParams)); _clientSessionFactory = _serverLocator.createSessionFactory();
ClientSessionFactory sf = serverLocator.createSessionFactory();
ClientSessionFactory consumerSessionFactory = consumerLocator.createSessionFactory(); HornetQRestLogger.LOGGER.debug("Created ClientSessionFactory: " + consumerSessionFactory); ClientSessionFactory sessionFactory = defaultLocator.createSessionFactory();
public synchronized void start() { if (!started) { log.debug("Starting RecoveryDiscovery on " + config); started = true; locator = config.createServerLocator(); locator.disableFinalizeCheck(); locator.addClusterTopologyListener(new InternalListener()); try { sessionFactory = (ClientSessionFactoryInternal)locator.createSessionFactory(); // We are using the SessionFactoryInternal here directly as we don't have information to connect with an user and password // on the session as all we want here is to get the topology // in case of failure we will retry sessionFactory.addFailureListener(this); log.debug("RecoveryDiscovery started fine on " + config); } catch (Exception startupError) { log.warn("Couldn't start recovery discovery on " + config + ", we will retry this on the next recovery scan"); stop(); HornetQRecoveryRegistry.getInstance().failedDiscovery(this); } } }
csf = serverLocator.createSessionFactory(); if (xaRecoveryConfig.getUsername() == null)
factory = serverLocator.createSessionFactory();