本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}