本文整理汇总了Java中org.apache.activemq.broker.TransportConnector.setName方法的典型用法代码示例。如果您正苦于以下问题:Java TransportConnector.setName方法的具体用法?Java TransportConnector.setName怎么用?Java TransportConnector.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.TransportConnector
的用法示例。
在下文中一共展示了TransportConnector.setName方法的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();
}
示例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;
}
示例3: createLocalBroker
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private void createLocalBroker() throws Exception {
localBroker = new BrokerService();
localBroker.setBrokerName("LOCAL");
localBroker.setUseJmx(true);
localBroker.setSchedulePeriodForDestinationPurge(5000);
ManagementContext managementContext = new ManagementContext();
managementContext.setCreateConnector(false);
localBroker.setManagementContext(managementContext);
PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local");
localBroker.setPersistenceAdapter(persistenceAdapter);
List<TransportConnector> transportConnectors = new ArrayList<>();
DebugTransportFactory tf = new DebugTransportFactory();
TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539"));
TransportConnector transportConnector = new TransportConnector(transport);
transportConnector.setName("tc");
transportConnector.setAuditNetworkProducers(true);
transportConnectors.add(transportConnector);
localBroker.setTransportConnectors(transportConnectors);
}
示例4: addTransportConnector
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected void addTransportConnector(BrokerService brokerService,
String connectorName,
String uri,
boolean clustered) throws Exception {
TransportConnector connector = brokerService.addConnector(uri);
connector.setName(connectorName);
if (clustered) {
connector.setRebalanceClusterClients(true);
connector.setUpdateClusterClients(true);
connector.setUpdateClusterClientsOnRemove(true);
} else {
connector.setRebalanceClusterClients(false);
connector.setUpdateClusterClients(false);
connector.setUpdateClusterClientsOnRemove(false);
}
}
示例5: 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);
}
示例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);
}
示例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);
}
示例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;
}
示例9: 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);
}
示例10: addAdditionalConnectors
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
protected void addAdditionalConnectors(BrokerService brokerService, Map<String, Integer> portMap) throws Exception {
int port = PORT;
if (portMap.containsKey(AMQP_CONNECTOR_NAME)) {
port = portMap.get(AMQP_CONNECTOR_NAME);
}
TransportConnector connector = brokerService
.addConnector("amqp://0.0.0.0:" + port + "?transport.transformer=" + getAmqpTransformer()
+ "&transport.socketBufferSize=" + getSocketBufferSize() + "&ioBufferSize=" + getIOBufferSize());
connector.setName(AMQP_CONNECTOR_NAME);
port = connector.getPublishableConnectURI().getPort();
LOG.debug("Using amqp port: {}", port);
}
示例11: createBroker
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
public BrokerService createBroker(String connectorName, String connectorString) throws Exception {
BrokerService broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
TransportConnector connector = broker.addConnector(connectorString);
connector.setName(connectorName);
broker.start();
broker.waitUntilStarted();
return broker;
}
示例12: createBrokerService
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private BrokerService createBrokerService(final String brokerName,
final String uri1,
final String uri2) throws Exception {
final BrokerService brokerService = new BrokerService();
brokerService.setBrokerName(brokerName);
brokerService.setPersistent(false);
brokerService.setUseJmx(true);
final SystemUsage memoryManager = new SystemUsage();
//memoryManager.getMemoryUsage().setLimit(10);
brokerService.setSystemUsage(memoryManager);
final List<PolicyEntry> policyEntries = new ArrayList<>();
final PolicyEntry entry = new PolicyEntry();
entry.setQueue(">");
//entry.setMemoryLimit(1);
policyEntries.add(entry);
final PolicyMap policyMap = new PolicyMap();
policyMap.setPolicyEntries(policyEntries);
brokerService.setDestinationPolicy(policyMap);
final TransportConnector tConnector = new TransportConnector();
tConnector.setUri(new URI(uri1));
tConnector.setName(brokerName + ".transportConnector");
brokerService.addConnector(tConnector);
if (uri2 != null) {
final NetworkConnector nc = new DiscoveryNetworkConnector(new URI("static:" + uri2));
nc.setBridgeTempDestinations(true);
nc.setBrokerName(brokerName);
//nc.setPrefetchSize(1);
brokerService.addNetworkConnector(nc);
}
return brokerService;
}
示例13: JMSBrokerController
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 JMSBrokerController(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);
}
示例14: getTCPConnector
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
* This will provide the TCP transport configuration
* @return TransportConnector for TCP transport
*/
private TransportConnector getTCPConnector() {
//setting the tcp transport configurations
TransportConnector tcp = new TransportConnector();
tcp.setName("tcp");
try {
tcp.setUri(new URI("tcp://127.0.0.1:61616"));
} catch (URISyntaxException e) {
log.error("Error while setting tcp uri :tcp://127.0.0.1:61616", e);
}
return tcp;
}
示例15: getMQTTConnector
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
* This will provide the MQTT transport configuration
* @return TransportConnector for MQTT transport
*/
private TransportConnector getMQTTConnector() {
//setting the mqtt transport configurations
TransportConnector mqtt = new TransportConnector();
mqtt.setName("mqtt");
try {
mqtt.setUri(new URI("mqtt://localhost:1883"));
} catch (URISyntaxException e) {
log.error("Error while setting MQTT uri:mqtt://localhost:1883");
}
return mqtt;
}