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


Java TransportConnector.setUri方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: configureBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected void configureBroker(BrokerService brokerService) throws Exception {
    brokerService.setBrokerName("testbroker1");
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);

    TransportConnector connector = new TransportConnector();
    connector.setUri(new URI("tcp://localhost:0"));
    connector.setName(testName.getMethodName());

    brokerService.addConnector(connector);
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:14,代码来源:PooledConnectionTempDestCleanupTest.java

示例7: JMSBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
 * Constructor to defined broker transport
 *
 * @param serverName    name for the server
 * @param configuration Transport configurations which should expose by the server
 */
public JMSBroker(String serverName, JMSBrokerConfiguration configuration) {
    this.serverName = serverName;
    this.transportConnectors = new ArrayList<TransportConnector>();
    TransportConnector connector = new TransportConnector();
    connector.setName("tcp");
    try {
        connector.setUri(new URI(configuration.getProviderURL()));
    } catch (URISyntaxException e) {
        log.error("Invalid URI", e);
    }
    transportConnectors.add(connector);

}
 
开发者ID:wso2,项目名称:product-ei,代码行数:20,代码来源:JMSBroker.java

示例8: getTCPConnectors

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private List<TransportConnector> getTCPConnectors() {
    //setting the tcp transport configurations
    List<TransportConnector> tcpList = new ArrayList<>();
    TransportConnector tcp = new TransportConnector();
    tcp.setName("tcp");
    try {
        tcp.setUri(new URI("tcp://127.0.0.1:61816"));
    } catch (URISyntaxException e) {
        log.error("Error while setting tcp uri :tcp://127.0.0.1:61816", e);
    }
    tcpList.add(tcp);
    return tcpList;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:14,代码来源:JMSEndpointSuspensionViaVFSTest.java

示例9: jmsMessageBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
 * ActiveMQ message broker as embedded service.
 */
@Bean
public BrokerService jmsMessageBroker() throws Exception {
    XBeanBrokerService messageBroker = new XBeanBrokerService ();

    TransportConnector connector = new TransportConnector();
    connector.setUri(new URI(jmsBrokerUrl));
    messageBroker.addConnector(connector);

    messageBroker.setStart(true);
    messageBroker.setUseJmx(false);
    messageBroker.setPersistent(false);

    return messageBroker;
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:18,代码来源:EndpointConfig.java

示例10: setupJmsBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private BrokerService setupJmsBroker() throws IOException, URISyntaxException, Exception
{
	//
	// we want to connect to an independently running JMS broker.
	final BrokerService broker = new BrokerService();
	broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
	broker.setDataDirectory("target/activemq-data");
	final TransportConnector connector = new TransportConnector();
	connector.setUri(new URI("tcp://localhost:61616"));
	broker.addConnector(connector);
	broker.start();
	return broker;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:14,代码来源:JaxRsSpringEndpointTests.java

示例11: setupJmsBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private BrokerService setupJmsBroker() throws IOException, URISyntaxException, Exception
{
	//
	// we want to connect to an independently running JMS broker.
	final BrokerService broker = new BrokerService();
	broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
	broker.setDataDirectory("target/activemq-data");
	final TransportConnector connector = new TransportConnector();
	connector.setUri(new URI(JMS_URL));
	broker.addConnector(connector);
	broker.start();

	return broker;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:JaxRsProgramaticTests.java

示例12: createJmsBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private BrokerService createJmsBroker() throws IOException, URISyntaxException, Exception
{
	//
	// we want to connect to an independently running JMS broker.
	final BrokerService broker = new BrokerService();
	broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
	broker.setDataDirectory("target/activemq-data");
	final TransportConnector connector = new TransportConnector();
	connector.setUri(new URI(JMS_URL));
	broker.addConnector(connector);
	broker.start();

	return broker;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:15,代码来源:JaxRsOneWayTests.java

示例13: createEmbeddedBrokerConnector

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private void createEmbeddedBrokerConnector() throws Exception
{
	final URI uri = getJmsURI();

	//
	// Remove the old connector if exists and if is not up2date
	final TransportConnector connectorOld = embeddedBroker.getConnectorByName(connectorName);
	if (connectorOld == null)
	{
		// nothing
	}
	else if (Objects.equals(connectorOld.getUri(), uri))
	{
		logger.info("JMS connector has not changed. Skip updating.");
		return;
	}
	else
	{
		logger.info("JMS connector URL has changed. Removing old connector: {}", connectorOld);
		embeddedBroker.removeConnector(connectorOld);
	}

	//
	// Adding the new connector
	final TransportConnector connector = new TransportConnector();
	connector.setName(connectorName);
	connector.setUri(uri);
	embeddedBroker.addConnector(connector);
	logger.info("JMS connector mapped to URL: " + uri);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:31,代码来源:JMSService.java

示例14: createBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected BrokerService createBroker(String scheme,
                                     String listenPort,
                                     String[] networkToPorts,
                                     HashMap<String, String> networkProps) throws Exception {
   BrokerService broker = new BrokerService();
   broker.getManagementContext().setCreateConnector(false);
   broker.setSslContext(sslContext);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.setBrokerName("Broker_" + listenPort);
   // lazy init listener on broker start
   TransportConnector transportConnector = new TransportConnector();
   transportConnector.setUri(new URI(scheme + "://localhost:" + listenPort));
   List<TransportConnector> transportConnectors = new ArrayList<>();
   transportConnectors.add(transportConnector);
   broker.setTransportConnectors(transportConnectors);
   if (networkToPorts != null && networkToPorts.length > 0) {
      StringBuilder builder = new StringBuilder("static:(failover:(" + scheme + "://localhost:");
      builder.append(networkToPorts[0]);
      for (int i = 1; i < networkToPorts.length; i++) {
         builder.append("," + scheme + "://localhost:" + networkToPorts[i]);
      }
      // limit the reconnects in case of initial random connection to slave
      // leaving randomize on verifies that this config is picked up
      builder.append(")?maxReconnectAttempts=0)?useExponentialBackOff=false");
      NetworkConnector nc = broker.addNetworkConnector(builder.toString());
      if (networkProps != null) {
         IntrospectionSupport.setProperties(nc, networkProps);
      }
   }
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:32,代码来源:FailoverStaticNetworkTest.java

示例15: createSlave

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected void createSlave() throws Exception {
   // use a separate thread as the slave will block waiting for
   // the exclusive db lock
   Thread t = new Thread() {
      @Override
      public void run() {
         try {
            BrokerService broker = new BrokerService();
            broker.setBrokerName("slave");
            TransportConnector connector = new TransportConnector();
            connector.setUri(new URI(SLAVE_URL));
            broker.addConnector(connector);
            // no need for broker.setMasterConnectorURI(masterConnectorURI)
            // as the db lock provides the slave/master initialisation
            broker.setUseJmx(false);
            broker.setPersistent(true);

            MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
            List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
            FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
            defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
            defaultEntry.setPerDestination(true);
            adapters.add(defaultEntry);

            mKahaDB.setFilteredPersistenceAdapters(adapters);
            broker.setPersistenceAdapter(mKahaDB);
            broker.start();
            slave.set(broker);
            slaveStarted.countDown();
         } catch (IllegalStateException expectedOnShutdown) {
         } catch (Exception e) {
            fail("failed to start slave broker, reason:" + e);
         }
      }
   };
   t.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:39,代码来源:mKahaDbQueueMasterSlaveTest.java


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