当前位置: 首页>>代码示例>>Java>>正文


Java TransportConnector类代码示例

本文整理汇总了Java中org.apache.activemq.broker.TransportConnector的典型用法代码示例。如果您正苦于以下问题:Java TransportConnector类的具体用法?Java TransportConnector怎么用?Java TransportConnector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransportConnector类属于org.apache.activemq.broker包,在下文中一共展示了TransportConnector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();
    connectionUri = connector.getPublishableConnectString();
    factory = new ActiveMQConnectionFactory(connectionUri);
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
    pooledFactory.setBlockIfSessionPoolIsFull(false);
    pooledFactory.setMaximumActiveSessionPerConnection(1);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:21,代码来源:PooledSessionExhaustionTest.java

示例2: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();

    connectionUri = connector.getPublishableConnectString();
    factory = new ActiveMQConnectionFactory(connectionUri);
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
    pooledFactory.setBlockIfSessionPoolIsFull(false);
    pooledFactory.setUseAnonymousProducers(false);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionNoPublisherCachingTest.java

示例3: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setUseJmx(true);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();

    connectionUri = connector.getPublishableConnectString();
    factory = new ActiveMQConnectionFactory(connectionUri);
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
    pooledFactory.setBlockIfSessionPoolIsFull(false);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionTest.java

示例4: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();

    connectionUri = connector.getPublishableConnectString();
    factory = new ActiveMQConnectionFactory(connectionUri);
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
    pooledFactory.setBlockIfSessionPoolIsFull(true);
    pooledFactory.setBlockIfSessionPoolIsFullTimeout(500);
    pooledFactory.setMaximumActiveSessionPerConnection(1);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:PooledSessionExhaustionBlockTimeoutTest.java

示例5: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();
    factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri() + "?closeAsync=false");
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:17,代码来源:PooledConnectionFactoryWithTemporaryDestinationsTest.java

示例6: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();
    factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri());
    pooledFactory = new JmsPoolConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:18,代码来源:PooledConnectionExpiryEvictsFromPoolTest.java

示例7: setUp

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

	MockitoAnnotations.initMocks(this);

	this.plugin = new KalinkaClusterPlugin(this.connectionStore, this.clientIdResolver);

	this.customizedBroker = new EmbeddedActiveMQBroker() {
		@Override
		protected void configure() {
			try {
				final TransportConnector connector = new TransportConnector();
				connector.setUri(new URI("mqtt://localhost:1883"));
				connector.setName("mqtt");
				this.getBrokerService().addConnector(connector);
				this.getBrokerService().setPlugins(new BrokerPlugin[] { plugin });
			} catch (final Exception e) {
				e.printStackTrace();
			}
		}
	};
	this.customizedBroker.start();
}
 
开发者ID:dcsolutions,项目名称:kalinka,代码行数:24,代码来源:KalinkaClusterPluginTest.java

示例8: configureTransportConnectors

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
 * Configure <code>TransporConnectors</code> lazily 
 * @return List<TransportConnector>
 * @throws URISyntaxException
 */
private List<TransportConnector> configureTransportConnectors() throws URISyntaxException{
	
	List<TransportConnector> transportConnectors = new ArrayList<>();
	
	// iterate the connectorNames 
	for(String name : connectorNames){
		TransportConnector tc = new TransportConnector();
		// construct URI string
		String uri = name + "://" + 
				cfg.getProperty(name+"."+CONNECTOR_HOST, CONNECTOR_HOST_VALUE) 
				+ ":" + cfg.getProperty(name+"."+CONNECTOR_PORT, CONNECTOR_PORT_VALUE);
		tc.setName(name);
		tc.setUri(new URI(uri));
		// add the transport
		transportConnectors.add(tc);
	}
	
	return transportConnectors;
}
 
开发者ID:MarceStarlet,项目名称:messaging,代码行数:25,代码来源:EmbeddedBroker.java

示例9: stop

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
 * Stopping ActiveMQ embedded broker
 *
 * @return true if broker is successfully stopped
 */
public boolean stop() {
    try {
        log.info(" ************* Stopping **************");
        if (broker.isStarted()) {
            broker.stop();
            for (TransportConnector transportConnector : transportConnectors) {
                transportConnector.stop();
            }
            setBrokerStatus(false);
        }
        return true;
    } catch (Exception e) {
        log.error("Error while shutting down the broker", e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:22,代码来源:JMSBroker.java

示例10: startActiveMQServer

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private void startActiveMQServer()
{
	try
	{
		final BrokerService broker = new BrokerService();
		// broker.getPersistenceAdapter().setDirectory(arg0);

		final TransportConnector connector = new TransportConnector();
		connector.setUri(new URI(ACTIVEMQ_URL));
		broker.addConnector(connector);
		broker.start();

		System.out.println("ActiveMQ started");
	}
	catch (Exception e)
	{
		throw new RuntimeException("Cannot start ActiveMQ server", e);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:StandaloneLauncher.java

示例11: main

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
public static void main(String[] args)
{
	//
	// Start ActiveMQ server
	try
	{
		final BrokerService broker = new BrokerService();

		final TransportConnector connector = new TransportConnector();
		connector.setUri(new URI(url));
		broker.addConnector(connector);
		broker.start();

		System.out.println("ActiveMQ started on " + connector.getUri());
	}
	catch (Exception e)
	{
		throw new RuntimeException("Cannot start ActiveMQ server", e);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:21,代码来源:SwingEventNotifier_ActiveMQServer.java

示例12: startActiveMQServer

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private void startActiveMQServer()
{
	try
	{
		final BrokerService broker = new BrokerService();
		// broker.getPersistenceAdapter().setDirectory(arg0);

		final TransportConnector connector = new TransportConnector();
		connector.setUri(new URI(ACTIVEMQ_URL));
		broker.addConnector(connector);
		broker.start();

		System.out.println("ActiveMQ started and listens to " + ACTIVEMQ_URL);
	}
	catch (Exception e)
	{
		throw new RuntimeException("Cannot start ActiveMQ server", e);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:EDI_StandaloneLauncher.java

示例13: addConnection

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
 * Overridden to allow for authentication using different Jaas
 * configurations depending on if the connection is SSL or not.
 *
 * @param context The context for the incoming Connection.
 * @param info The ConnectionInfo Command representing the incoming
 *                connection.
 */
@Override
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
    if (context.getSecurityContext() == null) {
        boolean isSSL;
        Connector connector = context.getConnector();
        if (connector instanceof TransportConnector) {
            TransportConnector transportConnector = (TransportConnector) connector;
            isSSL = transportConnector.getServer().isSslServer();
        } else {
            isSSL = false;
        }

        if (isSSL) {
            this.sslBroker.addConnection(context, info);
        } else {
            this.nonSslBroker.addConnection(context, info);
        }
        super.addConnection(context, info);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:29,代码来源:JaasDualAuthenticationBroker.java

示例14: removeConnection

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
/**
 * Overriding removeConnection to make sure the security context is cleaned.
 */
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
    boolean isSSL;
    Connector connector = context.getConnector();
    if (connector instanceof TransportConnector) {
        TransportConnector transportConnector = (TransportConnector) connector;
        isSSL = (transportConnector.getServer() instanceof SslTransportServer);
    } else {
        isSSL = false;
    }
    super.removeConnection(context, info, error);
    if (isSSL) {
        this.sslBroker.removeConnection(context, info, error);
    } else {
        this.nonSslBroker.removeConnection(context, info, error);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:21,代码来源:JaasDualAuthenticationBroker.java

示例15: validateBroker

import org.apache.activemq.broker.TransportConnector; //导入依赖的package包/类
private boolean validateBroker(String host) {
    boolean result = true;
    if (BROKERS.containsKey(host) || SERVERS.containsKey(host) || CONNECTORS.containsKey(host)) {
        // check the broker is still in the BrokerRegistry
        TransportConnector connector = CONNECTORS.get(host);
        if (BrokerRegistry.getInstance().lookup(host) == null
            || (connector != null && connector.getBroker().isStopped())) {
            result = false;
            // clean-up
            BROKERS.remove(host);
            SERVERS.remove(host);
            if (connector != null) {
                CONNECTORS.remove(host);
                if (connector != null) {
                    ServiceSupport.dispose(connector);
                }
            }
        }
    }
    return result;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:22,代码来源:VMTransportFactory.java


注:本文中的org.apache.activemq.broker.TransportConnector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。