use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.
the class DiscoveryUriTest method createBroker.
@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;
}
use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.
the class FailoverClusterTestSupport method createBroker.
protected BrokerService createBroker(String brokerName) throws Exception {
BrokerService answer = new BrokerService();
answer.setPersistent(false);
answer.setUseJmx(false);
answer.setBrokerName(brokerName);
answer.setUseShutdownHook(false);
return answer;
}
use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.
the class DiscoveryTransportNoBrokerTest method testNoExtraThreads.
public void testNoExtraThreads() throws Exception {
BrokerService broker = new BrokerService();
TransportConnector tcp = broker.addConnector("tcp://localhost:0?transport.closeAsync=false");
String group = "GR-" + System.currentTimeMillis();
URI discoveryUri = new URI("multicast://default?group=" + group);
tcp.setDiscoveryUri(discoveryUri);
broker.start();
broker.waitUntilStarted();
Vector<String> existingNames = new Vector<>();
Thread[] threads = getThreads();
for (Thread t : threads) {
existingNames.add(t.getName());
}
final int idleThreadCount = threads.length;
LOG.info("Broker started - thread Count:" + idleThreadCount);
final int noConnectionToCreate = 10;
for (int i = 0; i < 10; i++) {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("discovery:(multicast://239.255.2.3:6155?group=" + group + ")?closeAsync=false&startupMaxReconnectAttempts=10&initialReconnectDelay=1000");
LOG.info("Connecting.");
Connection connection = factory.createConnection();
connection.setClientID("test");
connection.close();
}
Thread.sleep(2000);
threads = getThreads();
for (Thread t : threads) {
if (!existingNames.contains(t.getName())) {
LOG.info("Remaining thread:" + t);
}
}
assertTrue("no extra threads per connection", Thread.activeCount() - idleThreadCount < noConnectionToCreate);
}
use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.
the class NIOJmsDurableTopicSendReceiveTest method createBroker.
protected BrokerService createBroker() throws Exception {
BrokerService answer = new BrokerService();
answer.setPersistent(false);
answer.addConnector(getBrokerURL());
return answer;
}
use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.
the class NIOPersistentSendAndReceiveTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
BrokerService answer = new BrokerService();
answer.setPersistent(true);
answer.addConnector(getBrokerURL());
return answer;
}
Aggregations