use of org.apache.activemq.artemis.core.server.management.ManagementService in project activemq-artemis by apache.
the class ActiveMQServerImpl method bindingQuery.
@Override
public BindingQueryResult bindingQuery(SimpleString address) throws Exception {
if (address == null) {
throw ActiveMQMessageBundle.BUNDLE.addressIsNull();
}
CompositeAddress addressKey = new CompositeAddress(address.toString());
String realAddress = addressKey.isFqqn() ? addressKey.getAddress() : addressKey.getQueueName();
AddressSettings addressSettings = getAddressSettingsRepository().getMatch(realAddress);
boolean autoCreateQeueus = addressSettings.isAutoCreateQueues();
boolean autoCreateAddresses = addressSettings.isAutoCreateAddresses();
boolean defaultPurgeOnNoConsumers = addressSettings.isDefaultPurgeOnNoConsumers();
int defaultMaxConsumers = addressSettings.getDefaultMaxConsumers();
boolean defaultExclusive = addressSettings.isDefaultExclusiveQueue();
boolean defaultLastValie = addressSettings.isDefaultLastValueQueue();
List<SimpleString> names = new ArrayList<>();
// make an exception for the management address (see HORNETQ-29)
ManagementService managementService = getManagementService();
SimpleString bindAddress = new SimpleString(realAddress);
if (managementService != null) {
if (bindAddress.equals(managementService.getManagementAddress())) {
return new BindingQueryResult(true, null, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers, defaultExclusive, defaultLastValie);
}
}
Bindings bindings = getPostOffice().getMatchingBindings(bindAddress);
for (Binding binding : bindings.getBindings()) {
if (binding.getType() == BindingType.LOCAL_QUEUE || binding.getType() == BindingType.REMOTE_QUEUE) {
if (addressKey.isFqqn()) {
names.add(new SimpleString(addressKey.getAddress()).concat(CompositeAddress.SEPARATOR).concat(binding.getUniqueName()));
} else {
names.add(binding.getUniqueName());
}
}
}
AddressInfo info = getAddressInfo(bindAddress);
return new BindingQueryResult(info != null, info, names, autoCreateQeueus, autoCreateAddresses, defaultPurgeOnNoConsumers, defaultMaxConsumers, defaultExclusive, defaultLastValie);
}
use of org.apache.activemq.artemis.core.server.management.ManagementService in project activemq-artemis by apache.
the class FailoverBackupLeakTest method getConnectionCount.
private int getConnectionCount(EmbeddedJMS server) throws Exception {
ManagementService managementService = server.getActiveMQServer().getManagementService();
ActiveMQServerControl jmsControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.BROKER);
String[] ids = jmsControl.listConnectionIDs();
if (ids != null) {
return ids.length;
}
return 0;
}
use of org.apache.activemq.artemis.core.server.management.ManagementService in project activemq-artemis by apache.
the class BridgeTestBase method checkEmpty.
public boolean checkEmpty(final Queue queue, final int index) throws Exception {
ManagementService managementService = server0.getManagementService();
if (index == 1) {
managementService = server1.getManagementService();
}
QueueControl queueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + queue.getQueueName());
// server may be closed
if (queueControl != null) {
queueControl.flushExecutor();
Long messageCount = queueControl.getMessageCount();
if (messageCount > 0) {
queueControl.removeMessages(null);
}
}
return true;
}
use of org.apache.activemq.artemis.core.server.management.ManagementService in project activemq-artemis by apache.
the class BridgeTestBase method checkNoSubscriptions.
protected void checkNoSubscriptions(final Topic topic, final int index) throws Exception {
ManagementService managementService = server0.getManagementService();
if (index == 1) {
managementService = server1.getManagementService();
}
AddressControl topicControl = (AddressControl) managementService.getResource(ResourceNames.ADDRESS + topic.getTopicName());
if (topicControl != null) {
Assert.assertEquals(0, topicControl.getQueueNames().length);
}
}
use of org.apache.activemq.artemis.core.server.management.ManagementService in project wildfly by wildfly.
the class ActiveMQServerResource method getCoreAddressNames.
private Set<String> getCoreAddressNames() {
final ManagementService managementService = getManagementService();
if (managementService == null) {
return Collections.emptySet();
} else {
Set<String> result = new HashSet<String>();
for (Object obj : managementService.getResources(AddressControl.class)) {
AddressControl ac = AddressControl.class.cast(obj);
result.add(ac.getAddress());
}
return result;
}
}
Aggregations