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


Java BrokerService.waitUntilStarted方法代码示例

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


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

示例1: start

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
/**
 * @param The activemq connector uri, for instance: "failover:(tcp://localhost:61616)?startupMaxReconnectAttempts=3"
 *        The failover:() is stipped out so that a tcp:// uri is created for the server.
 */
@Override
public URI start(String suggestedURI) throws EventException {

	try {
		Pattern pattern = Pattern.compile(".*(tcp://[a-zA-Z\\.]+:\\d+).*");
		Matcher matcher = pattern.matcher(suggestedURI);
		if (matcher.matches()) suggestedURI = matcher.group(1);

		URI uri = new URI(suggestedURI); // Each test uses a new port if the port is running on another test.
		service = new BrokerService();
        service.addConnector(uri);
        service.setPersistent(false);
		service.addConnector("stomp://localhost:61613"); // Allow stomp connections (for Python clients, etc.).
        SystemUsage systemUsage = service.getSystemUsage();
        systemUsage.getStoreUsage().setLimit(1024 * 1024 * 8);
        systemUsage.getTempUsage().setLimit(1024 * 1024 * 8);
        service.start();
		service.waitUntilStarted();
		return uri;

	} catch (Exception ne) {
		throw new EventException(ne);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:29,代码来源:ActivemqConnectorService.java

示例2: testBridgeRegistration

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testBridgeRegistration() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName(BROKER_NAME);
   broker.setUseJmx(true); // explicitly set this so no funny issues
   broker.start();
   broker.waitUntilStarted();

   // now create network connector over JMX
   ObjectName brokerObjectName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + BROKER_NAME);
   BrokerViewMBean proxy = (BrokerViewMBean) broker.getManagementContext().newProxyInstance(brokerObjectName, BrokerViewMBean.class, true);

   assertNotNull("We could not retrieve the broker from JMX", proxy);

   // let's add the NC
   String connectoName = proxy.addNetworkConnector("static:(tcp://localhost:61617)");
   assertEquals("NC", connectoName);

   // Make sure we can retrieve the NC through JMX
   ObjectName networkConnectorObjectName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + BROKER_NAME +
                                                             ",connector=networkConnectors,networkConnectorName=" + connectoName);
   NetworkConnectorViewMBean nc = (NetworkConnectorViewMBean) broker.getManagementContext().newProxyInstance(networkConnectorObjectName, NetworkConnectorViewMBean.class, true);

   assertNotNull(nc);
   assertEquals("NC", nc.getName());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:JmxCreateNCTest.java

示例3: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
  LOG.info("Finding free network port");
  try (ServerSocket socket = new ServerSocket(0)) {
    port = socket.getLocalPort();
  }

  LOG.info("Starting ActiveMQ brokerService on {}", port);
  brokerService = new BrokerService();
  brokerService.setDeleteAllMessagesOnStartup(true);
  // use memory persistence for the test: it's faster and don't pollute test folder with KahaDB
  brokerService.setPersistent(false);
  brokerService.addConnector("mqtt://localhost:" + port);
  brokerService.start();
  brokerService.waitUntilStarted();
}
 
开发者ID:apache,项目名称:beam,代码行数:17,代码来源:MqttIOTest.java

示例4: createRemoteBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createRemoteBroker() throws Exception {
   remoteBroker = new BrokerService();
   remoteBroker.setBrokerName("remotehost");
   remoteBroker.setUseJmx(true);
   remoteBroker.setPersistenceAdapter(null);
   remoteBroker.setPersistent(false);
   remoteConnector = createRemoteConnector();
   remoteBroker.addConnector(remoteConnector);
   configureBroker(remoteBroker);
   remoteBroker.start();
   remoteBroker.waitUntilStarted();

   remoteBroker.getManagementContext().setConnectorPort(2222);

   brokers.put(remoteBroker.getBrokerName(), remoteBroker);

   return remoteBroker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:BrokerNetworkWithStuckMessagesTest.java

示例5: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
   System.setProperty("javax.net.ssl.trustStore", TRUST_KEYSTORE);
   System.setProperty("javax.net.ssl.trustStorePassword", PASSWORD);
   System.setProperty("javax.net.ssl.trustStoreType", KEYSTORE_TYPE);
   System.setProperty("javax.net.ssl.keyStore", SERVER_KEYSTORE);
   System.setProperty("javax.net.ssl.keyStoreType", KEYSTORE_TYPE);
   System.setProperty("javax.net.ssl.keyStorePassword", PASSWORD);

   broker = new BrokerService();
   broker.setPersistent(false);
   broker.setUseJmx(false);
   TransportConnector connector = broker.addConnector("nio+ssl://localhost:0?transport.needClientAuth=true");
   broker.start();
   broker.waitUntilStarted();

   messageData = new byte[MESSAGE_SIZE];
   for (int i = 0; i < MESSAGE_SIZE; i++) {
      messageData[i] = (byte) (i & 0xff);
   }

   ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("nio+ssl://localhost:" + connector.getConnectUri().getPort());
   connection = factory.createConnection();
   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   connection.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:NIOSSLWindowSizeTest.java

示例6: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
   LOG.info("Setting up LocalBroker");
   localBroker = new BrokerService();
   localBroker.setBrokerName("LocalBroker");
   localBroker.setUseJmx(false);
   localBroker.setPersistent(false);
   localBroker.setTransportConnectorURIs(new String[]{LOCAL_BROKER_TRANSPORT_URI});
   localBroker.start();
   localBroker.waitUntilStarted();

   LOG.info("Setting up RemoteBroker");
   remoteBroker = new BrokerService();
   remoteBroker.setBrokerName("RemoteBroker");
   remoteBroker.setUseJmx(false);
   remoteBroker.setPersistent(false);
   remoteBroker.setTransportConnectorURIs(new String[]{REMOTE_BROKER_TRANSPORT_URI});
   remoteBroker.start();
   remoteBroker.waitUntilStarted();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:NetworkConnectionsTest.java

示例7: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private BrokerService createBroker() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("localhost");
   broker.setUseJmx(true);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.addConnector("vm://localhost");

   PolicyMap policyMap = new PolicyMap();
   PolicyEntry defaultEntry = new PolicyEntry();
   defaultEntry.setAdvisoryForSlowConsumers(true);

   policyMap.setDefaultEntry(defaultEntry);

   broker.setDestinationPolicy(policyMap);
   broker.start();
   broker.waitUntilStarted();
   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:TopicSubscriptionSlowConsumerTest.java

示例8: setUp

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

   // Setup and start the broker
   broker = new BrokerService();
   broker.setBrokerName(brokerName);
   broker.setPersistent(false);
   broker.setSchedulerSupport(false);
   broker.setUseJmx(false);
   broker.setUseShutdownHook(false);
   broker.addConnector(brokerUrl);

   // Start the broker
   broker.start();
   broker.waitUntilStarted();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:QueueOptimizedDispatchExceptionTest.java

示例9: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected BrokerService createBroker() throws Exception {
    BrokerService brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);

    connectionURI = brokerService.addConnector("amqp://localhost:0").getPublishableConnectString();

    brokerService.start();
    brokerService.waitUntilStarted();

    return brokerService;
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:16,代码来源:QpidJmsPoolTestSupport.java

示例10: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
/**
 * Prepare to run a test case: create, configure, and start the embedded
 * broker, as well as creating the client connections to the broker.
 */
@Override
@Before
public void setUp() throws java.lang.Exception {
    super.setUp();

    brokerService = new BrokerService();
    configureBroker(brokerService);
    brokerService.start();
    brokerService.waitUntilStarted();

    // Create the ActiveMQConnectionFactory and the JmsPoolConnectionFactory.
    directConnFact = new ActiveMQConnectionFactory(getBrokerConnectionURI());
    pooledConnFact = new JmsPoolConnectionFactory();
    pooledConnFact.setConnectionFactory(directConnFact);

    // Prepare the connections
    directConn1 = directConnFact.createConnection();
    directConn1.start();
    directConn2 = directConnFact.createConnection();
    directConn2.start();

    pooledConn1 = pooledConnFact.createConnection();
    pooledConn1.start();
    pooledConn2 = pooledConnFact.createConnection();
    pooledConn2.start();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:31,代码来源:PooledConnectionTempDestCleanupTest.java

示例11: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected String createBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setBrokerName("PooledConnectionSessionCleanupTestBroker");
    brokerService.setUseJmx(true);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.setPersistent(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://0.0.0.0:61626");
    brokerService.start();
    brokerService.waitUntilStarted();

    return "failover:(" + connector.getPublishableConnectString() + ")?maxReconnectAttempts=5";
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:16,代码来源:PooledConnectionFailoverTest.java

示例12: setUp

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
/**
 * Prepare to run a test case: create, configure, and start the embedded
 * broker, as well as creating the client connections to the broker.
 */
@Override
@Before
public void setUp() throws java.lang.Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setBrokerName("PooledConnectionSessionCleanupTestBroker");
    brokerService.setUseJmx(true);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.setPersistent(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    brokerService.start();
    brokerService.waitUntilStarted();

    // Create the ActiveMQConnectionFactory and the JmsPoolConnectionFactory.
    // Set a long idle timeout on the pooled connections to better show the
    // problem of holding onto created resources on close.
    directConnFact = new ActiveMQConnectionFactory(brokerService.getVmConnectorURI());
    pooledConnFact = new JmsPoolConnectionFactory();
    pooledConnFact.setConnectionFactory(directConnFact);
    pooledConnFact.setIdleTimeout((int)TimeUnit.MINUTES.toMillis(60));
    pooledConnFact.setMaxConnections(1);

    // Prepare the connections
    directConn1 = directConnFact.createConnection();
    directConn1.start();
    directConn2 = directConnFact.createConnection();
    directConn2.start();

    // The pooled Connections should have the same underlying connection
    pooledConn1 = pooledConnFact.createConnection();
    pooledConn1.start();
    pooledConn2 = pooledConnFact.createConnection();
    pooledConn2.start();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:41,代码来源:PooledConnectionSessionCleanupTest.java

示例13: setUp

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

    brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    brokerService.start();
    brokerService.waitUntilStarted();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:15,代码来源:PooledConnectionExpiredConnectionsUnderLoad.java

示例14: createBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected String createBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setPersistent(false);
    brokerService.setUseJmx(false);
    brokerService.setAdvisorySupport(false);
    brokerService.setSchedulerSupport(false);
    brokerService.start();
    brokerService.waitUntilStarted();

    return brokerService.getVmConnectorURI().toString();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:13,代码来源:ActiveMQJmsPoolTestSupport.java

示例15: startBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void startBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setAdvisorySupport(false);
    brokerService.getManagementContext().setCreateConnector(false);
    brokerService.getManagementContext().setCreateMBeanServer(false);
    brokerService.addConnector("tcp://0.0.0.0:0");

    ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();

    BrokerPlugin authenticationPlugin = configureAuthentication();
    if (authenticationPlugin != null) {
        plugins.add(configureAuthorization());
    }

    BrokerPlugin authorizationPlugin = configureAuthorization();
    if (authorizationPlugin != null) {
        plugins.add(configureAuthentication());
    }

    if (!plugins.isEmpty()) {
        BrokerPlugin[] array = new BrokerPlugin[plugins.size()];
        brokerService.setPlugins(plugins.toArray(array));
    }

    brokerService.start();
    brokerService.waitUntilStarted();

    connectionURI = brokerService.getTransportConnectors().get(0).getPublishableConnectString();
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:32,代码来源:PooledConnectionSecurityExceptionTest.java


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