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


Java TransportConnector.getConnectUri方法代码示例

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


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

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

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

示例3: startBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
   broker = createBroker();
   TransportConnector connector = broker.addConnector("tcp://0.0.0.0:0");
   broker.deleteAllMessages();
   broker.start();
   broker.waitUntilStarted();

   PolicyEntry policy = new PolicyEntry();
   policy.setMaxPageSize(maxPageSize);
   broker.setDestinationPolicy(new PolicyMap());
   broker.getDestinationPolicy().setDefaultEntry(policy);

   connectUri = connector.getConnectUri();
   factory = new ActiveMQConnectionFactory(connectUri);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:QueueBrowsingTest.java

示例4: startBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
   broker = createBroker();
   TransportConnector connector = broker.addConnector("tcp://0.0.0.0:0");
   broker.deleteAllMessages();
   broker.start();
   broker.waitUntilStarted();

   PolicyEntry policy = new PolicyEntry();
   policy.setMaxBrowsePageSize(browserLimit);
   broker.setDestinationPolicy(new PolicyMap());
   broker.getDestinationPolicy().setDefaultEntry(policy);

   connectUri = connector.getConnectUri();
   factory = new ActiveMQConnectionFactory(connectUri);

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:QueueBrowsingLimitTest.java

示例5: verifySslCredentials

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private boolean verifySslCredentials(BrokerService broker) throws Exception {
   TransportConnector connector = broker.getTransportConnectors().get(0);
   URI brokerUri = connector.getConnectUri();

   SSLContext context = SSLContext.getInstance("TLS");
   CertChainCatcher catcher = new CertChainCatcher();
   context.init(null, new TrustManager[]{catcher}, null);

   SSLSocketFactory factory = context.getSocketFactory();
   LOG.info("Connecting to broker: " + broker.getBrokerName() + " on: " + brokerUri.getHost() + ":" + brokerUri.getPort());
   SSLSocket socket = (SSLSocket) factory.createSocket(brokerUri.getHost(), brokerUri.getPort());
   socket.setSoTimeout(2 * 60 * 1000);
   socket.startHandshake();
   socket.close();

   boolean matches = false;
   if (catcher.serverCerts != null) {
      for (int i = 0; i < catcher.serverCerts.length; i++) {
         X509Certificate cert = catcher.serverCerts[i];
         LOG.info(" " + (i + 1) + " Issuer " + cert.getIssuerDN());
      }
      if (catcher.serverCerts.length > 0) {
         String issuer = catcher.serverCerts[0].getIssuerDN().toString();
         if (issuer.indexOf(broker.getBrokerName()) != -1) {
            matches = true;
         }
      }
   }
   return matches;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:31,代码来源:SslContextNBrokerServiceTest.java

示例6: createBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected BrokerService createBroker(boolean delete) throws Exception {
   BrokerService answer = new BrokerService();
   answer.setPersistent(false);
   answer.setDeleteAllMessagesOnStartup(true);
   answer.setSchedulerSupport(false);
   answer.setUseJmx(true);
   TransportConnector connector = answer.addConnector("tcp://localhost:0");
   tcpUri = connector.getConnectUri();
   return answer;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:ConsumeUncompressedCompressedMessageTest.java

示例7: setup

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  broker = createBroker();
  connector = new TransportConnector();
  connector.setUri(new URI("vm://localhost"));
  broker.addConnector(connector);
  broker.start();

  ActiveMQConnectionFactory connFactory =
      new ActiveMQConnectionFactory(connector.getConnectUri() + "?jms.prefetchPolicy.all=1");
  connection = connFactory.createConnection();
  connection.start();
}
 
开发者ID:camunda,项目名称:camunda-bpm-elasticsearch,代码行数:14,代码来源:AbstractElasticSearchActiveMQTest.java

示例8: testSendToRemovedTemp

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

      ActiveMQQueue requestReplyDest = new ActiveMQQueue("RequestReply");

      NetworkConnector nc = bridgeBrokers("BrokerA", "BrokerB");
      if (useDuplex) {
         nc.setDuplex(true);
      } else {
         bridgeBrokers("BrokerB", "BrokerA");
      }

      // destination advisory can loose the race with message dispatch, so we need to allow replies on network broker
      // to work in the absence of an advisory, the destination will be cleaned up in the normal
      // way
      if (!useDuplex) {
         brokers.get("BrokerB").broker.setAllowTempAutoCreationOnSend(true);
      }

      TransportConnector forClient = brokers.get("BrokerA").broker.addConnector("tcp://localhost:0");
      startAllBrokers();
      waitForBridgeFormation();
      waitForMinTopicRegionConsumerCount("BrokerB", 1);
      waitForMinTopicRegionConsumerCount("BrokerA", 1);

      ConnectionFactory factory = new ActiveMQConnectionFactory(forClient.getConnectUri());
      ActiveMQConnection conn = (ActiveMQConnection) factory.createConnection();
      conn.setWatchTopicAdvisories(false);
      conn.start();
      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      ConnectionFactory replyFactory = getConnectionFactory("BrokerB");
      for (int i = 0; i < 500; i++) {
         TemporaryQueue tempDest = session.createTemporaryQueue();
         MessageProducer producer = session.createProducer(requestReplyDest);
         javax.jms.Message message = session.createTextMessage("req-" + i);
         message.setJMSReplyTo(tempDest);

         ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(tempDest);
         producer.send(message);

         ActiveMQConnection replyConnection = (ActiveMQConnection) replyFactory.createConnection();
         replyConnection.setWatchTopicAdvisories(false);
         replyConnection.start();
         Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         ActiveMQMessageConsumer replyConsumer = (ActiveMQMessageConsumer) replySession.createConsumer(requestReplyDest);
         javax.jms.Message msg = replyConsumer.receive(10000);
         assertNotNull("request message not null: " + i, msg);
         MessageProducer replyProducer = replySession.createProducer(msg.getJMSReplyTo());
         replyProducer.send(session.createTextMessage("reply-" + i));
         replyConnection.close();

         javax.jms.Message reply = consumer.receive(10000);
         assertNotNull("reply message : " + i + ", to: " + tempDest + ", by consumer:" + consumer.getConsumerId(), reply);
         consumer.close();
         tempDest.delete();
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:58,代码来源:TwoBrokerTempQueueAdvisoryTest.java

示例9: test

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
public void test() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setPersistent(false);
   broker.setUseJmx(true);
   broker.setPlugins(new BrokerPlugin[]{new ConnectionDotFilePlugin(), new UDPTraceBrokerPlugin()});
   TransportConnector tcpConnector = broker.addConnector("tcp://localhost:0");
   broker.addConnector("stomp://localhost:0");
   broker.start();

   // Create a ConnectionFactory
   ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(tcpConnector.getConnectUri());

   // Create a Connection
   Connection connection = connectionFactory.createConnection();
   connection.start();

   // Create a Session
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

   // Create the destination Queue
   Destination destination = session.createQueue("TEST.FOO");

   // Create a MessageProducer from the Session to the Topic or Queue
   MessageProducer producer = session.createProducer(destination);
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

   // Create a messages
   Message sentMessage = session.createMessage();

   // Tell the producer to send the message
   long beforeSend = System.currentTimeMillis();
   producer.send(sentMessage);
   long afterSend = System.currentTimeMillis();

   // assert message timestamp is in window
   assertTrue(beforeSend <= sentMessage.getJMSTimestamp() && sentMessage.getJMSTimestamp() <= afterSend);

   // Create a MessageConsumer from the Session to the Topic or Queue
   MessageConsumer consumer = session.createConsumer(destination);

   // Wait for a message
   Message receivedMessage = consumer.receive(1000);

   // assert we got the same message ID we sent
   assertEquals(sentMessage.getJMSMessageID(), receivedMessage.getJMSMessageID());

   // assert message timestamp is in window
   assertTrue("JMS Message Timestamp should be set during the send method: \n" + "        beforeSend = " + beforeSend + "\n" + "   getJMSTimestamp = " + receivedMessage.getJMSTimestamp() + "\n" + "         afterSend = " + afterSend + "\n", beforeSend <= receivedMessage.getJMSTimestamp() && receivedMessage.getJMSTimestamp() <= afterSend);

   // assert message timestamp is unchanged
   assertEquals("JMS Message Timestamp of received message should be the same as the sent message\n        ", sentMessage.getJMSTimestamp(), receivedMessage.getJMSTimestamp());

   // Clean up
   producer.close();
   consumer.close();
   session.close();
   connection.close();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:59,代码来源:TimeStampTest.java


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