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


Java TransportConnector.setDiscoveryUri方法代码示例

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


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

示例1: bridgeBrokers

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker,
                                         BrokerService remoteBroker,
                                         boolean dynamicOnly,
                                         int networkTTL,
                                         boolean conduit,
                                         boolean failover) throws Exception {
   String networkDisoveryUrlString = useStaticDiscovery ? "static:(" + remoteBroker.getTransportConnectors().get(0).getPublishableConnectString() + ")?useExponentialBackOff=false" : "multicast://default?group=TESTERIC&useLocalHost=false";

   DiscoveryNetworkConnector connector = new DiscoveryNetworkConnector(new URI(networkDisoveryUrlString));
   connector.setDynamicOnly(dynamicOnly);
   connector.setNetworkTTL(networkTTL);
   connector.setDuplex(useDuplexNetworkBridge);
   maxSetupTime = 2000;
   if (!useStaticDiscovery) {
      List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
      if (!transportConnectors.isEmpty()) {
         TransportConnector mCastTrpConnector = (transportConnectors.get(0));
         mCastTrpConnector.setDiscoveryUri(new URI("multicast://default?group=TESTERIC"));
      }
   }
   localBroker.addNetworkConnector(connector);
   return connector;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:MulticastDiscoveryOnFaultyNetworkTest.java

示例2: bridgeAllBrokers

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected void bridgeAllBrokers(String groupName,
                                int ttl,
                                boolean suppressduplicateQueueSubs,
                                boolean decreasePriority) throws Exception {
   Collection<BrokerItem> brokerList = brokers.values();
   for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext(); ) {
      BrokerService broker = i.next().broker;
      List<TransportConnector> transportConnectors = broker.getTransportConnectors();

      if (transportConnectors.isEmpty()) {
         broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
         transportConnectors = broker.getTransportConnectors();
      }

      TransportConnector transport = transportConnectors.get(0);
      transport.setDiscoveryUri(new URI("multicast://default?group=" + groupName));
      NetworkConnector nc = broker.addNetworkConnector("multicast://default?group=" + groupName);
      nc.setNetworkTTL(ttl);
      nc.setSuppressDuplicateQueueSubscriptions(suppressduplicateQueueSubs);
      nc.setDecreaseNetworkConsumerPriority(decreasePriority);
   }

   // Multicasting may take longer to setup
   maxSetupTime = 8000;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:JmsMultipleBrokersTestSupport.java

示例3: addAdditionalConnectors

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected void addAdditionalConnectors(BrokerService brokerService, Map<String, Integer> portMap) throws Exception {
    int port = 0;
    if (portMap.containsKey("amqp")) {
        port = portMap.get("amqp");
    }
    TransportConnector connector = brokerService.addConnector(
        "amqp://0.0.0.0:" + port + "?transport.transformer=" + getAmqpTransformer() +
        "&transport.socketBufferSize=" + getSocketBufferSize() + "&ioBufferSize=" + getIOBufferSize());
    connector.setName("amqp");
    if (isAmqpDiscovery()) {
        connector.setDiscoveryUri(new URI("multicast://default"));
    }
    port = connector.getPublishableConnectURI().getPort();
    LOG.debug("Using amqp port: {}", port);
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:17,代码来源:AmqpTestSupport.java

示例4: createBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   bindAddress = "tcp://localhost:0";
   BrokerService answer = new BrokerService();
   answer.setPersistent(isPersistent());
   TransportConnector connector = new TransportConnector();
   connector.setUri(new URI(bindAddress));
   connector.setDiscoveryUri(new URI("multicast://default?group=test"));
   answer.addConnector(connector);
   return answer;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:DiscoveryUriTest.java

示例5: bridgeAllBrokers

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected void bridgeAllBrokers(String groupName,
                                int ttl,
                                boolean suppressduplicateQueueSubs,
                                boolean decreasePriority) throws Exception {
   Collection<BrokerItem> brokerList = brokers.values();
   for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext(); ) {
      BrokerService broker = i.next().broker;
      List<TransportConnector> transportConnectors = broker.getTransportConnectors();

      if (transportConnectors.isEmpty()) {
         broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
         transportConnectors = broker.getTransportConnectors();
      }

      TransportConnector transport = transportConnectors.get(0);
      if (transport.getDiscoveryUri() == null) {
         transport.setDiscoveryUri(new URI("multicast://default?group=" + groupName));
      }

      List<NetworkConnector> networkConnectors = broker.getNetworkConnectors();
      if (networkConnectors.isEmpty()) {
         broker.addNetworkConnector("multicast://default?group=" + groupName);
         networkConnectors = broker.getNetworkConnectors();
      }

      NetworkConnector nc = networkConnectors.get(0);
      nc.setNetworkTTL(ttl);
      nc.setSuppressDuplicateQueueSubscriptions(suppressduplicateQueueSubs);
      nc.setDecreaseNetworkConsumerPriority(decreasePriority);
   }

   // Multicasting may take longer to setup
   maxSetupTime = 8000;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:36,代码来源:NetworkOfTwentyBrokersTest.java

示例6: createBroker

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

        BrokerService brokerService = new BrokerService();
        brokerService.setBrokerName("localhost");
        brokerService.setPersistent(false);
        brokerService.setAdvisorySupport(false);
        brokerService.setUseJmx(false);

        TransportConnector connector = brokerService.addConnector("amqp://0.0.0.0:0");
        connector.setName("amqp");
        connector.setDiscoveryUri(new URI("multicast://default"));

        return brokerService;
    }
 
开发者ID:apache,项目名称:qpid-jms,代码行数:15,代码来源:JmsDiscoveryProviderTest.java

示例7: addAdditionalConnectors

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected void addAdditionalConnectors(BrokerService brokerService, Map<String, Integer> portMap) throws Exception {
    int port = PORT;
    if (portMap.containsKey("amqp")) {
        port = portMap.get("amqp");
    }
    TransportConnector connector = brokerService.addConnector(
        "amqp://0.0.0.0:" + port +
        "?transport.transformer=" + getAmqpTransformer() +
        "&transport.socketBufferSize=" + getSocketBufferSize() +
        "&transport.tcpNoDelay=true" +
        "&ioBufferSize=" + getIOBufferSize());
    connector.setName("amqp");
    if (isAmqpDiscovery()) {
        String uriString = "multicast://default";
        if(getDiscoveryNetworkInterface() != null) {
            uriString += "?networkInterface=" + getDiscoveryNetworkInterface();
        }
        connector.setDiscoveryUri(new URI(uriString));
    }
    port = connector.getPublishableConnectURI().getPort();
    LOG.debug("Using amqp port: {}", port);

    if (isAddOpenWireConnector()) {
        if (portMap.containsKey("openwire")) {
            port = portMap.get("openwire");
        } else {
            port = 0;
        }

        connector = brokerService.addConnector("tcp://0.0.0.0:" + port);
        connector.setName("openwire");

        LOG.debug("Using openwire port: {}", port);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:37,代码来源:AmqpTestSupport.java

示例8: addAdditionalConnectors

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected void addAdditionalConnectors(BrokerService brokerService, Map<String, Integer> portMap) throws Exception {
    int port = 0;
    if (portMap.containsKey("stomp")) {
        port = portMap.get("stomp");
    }
    TransportConnector connector = brokerService.addConnector("stomp://0.0.0.0:" + port);
    connector.setName("stomp");
    if (isStompDiscovery()) {
        connector.setDiscoveryUri(new URI("multicast://default"));
    }
    port = connector.getPublishableConnectURI().getPort();
    LOG.debug("Using stomp port: {}", port);
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:15,代码来源:StompTestSupport.java

示例9: createBroker

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected BrokerService createBroker(int brokerId) throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("broker-" + brokerId);
   broker.setPersistent(false);
   broker.setUseJmx(true);
   broker.getManagementContext().setCreateConnector(false);

   final SystemUsage memoryManager = new SystemUsage();
   memoryManager.getMemoryUsage().setLimit(1024 * 1024 * 50); // 50 MB
   broker.setSystemUsage(memoryManager);

   final List<PolicyEntry> policyEntries = new ArrayList<>();
   final PolicyEntry entry = new PolicyEntry();
   entry.setQueue(">");
   entry.setMemoryLimit(1024 * 1024 * 1); // Set to 1 MB
   entry.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
   entry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
   policyEntries.add(entry);

   // This is to turn of the default behavior of storing topic messages for retroactive consumption
   final PolicyEntry topicPolicyEntry = new PolicyEntry();
   topicPolicyEntry.setTopic(">");
   final NoSubscriptionRecoveryPolicy noSubscriptionRecoveryPolicy = new NoSubscriptionRecoveryPolicy();
   topicPolicyEntry.setSubscriptionRecoveryPolicy(noSubscriptionRecoveryPolicy);

   final PolicyMap policyMap = new PolicyMap();
   policyMap.setPolicyEntries(policyEntries);
   broker.setDestinationPolicy(policyMap);

   TransportConnector transportConnector = new TransportConnector();
   transportConnector.setUri(new URI("tcp://localhost:" + (60000 + brokerId)));

   transportConnector.setDiscoveryUri(new URI("multicast://default?group=" + groupId));
   broker.addConnector(transportConnector);

   DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
   networkConnector.setUri(new URI("multicast://default?group=" + groupId));
   networkConnector.setBridgeTempDestinations(true);
   networkConnector.setPrefetchSize(1);
   broker.addNetworkConnector(networkConnector);

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

示例10: createConnector

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected TransportConnector createConnector() throws Exception, IOException, URISyntaxException {
   TransportConnector x = super.createConnector();
   x.setDiscoveryUri(new URI(getDiscoveryUri()));
   return x;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:DiscoveryTransportBrokerTest.java

示例11: createRemoteConnector

import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
protected TransportConnector createRemoteConnector() throws Exception, IOException, URISyntaxException {
   TransportConnector x = super.createRemoteConnector();
   x.setDiscoveryUri(new URI(getDiscoveryUri()));
   return x;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:DiscoveryTransportBrokerTest.java


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