ARTEMIS-3822 get broker name via management

This commit is contained in:
Justin Bertram 2022-05-09 13:29:16 -05:00
parent 41d5ba7664
commit 466597e83b
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
4 changed files with 28 additions and 0 deletions

View File

@ -32,6 +32,12 @@ public interface ActiveMQServerControl {
String ADDRESS_MEMORY_USAGE_PERCENTAGE_DESCRIPTION = "Memory used by all the addresses on broker as a percentage of the global-max-size";
String DISK_STORE_USAGE_DESCRIPTION = "Fraction of total disk store used";
/**
* Returns this server's name.
*/
@Attribute(desc = "Server's name")
String getName();
/**
* Returns this server's version.
*/

View File

@ -204,6 +204,21 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
}
}
@Override
public String getName() {
if (AuditLogger.isBaseLoggingEnabled()) {
AuditLogger.getName(this.server);
}
checkStarted();
clearIO();
try {
return server.getConfiguration().getName();
} finally {
blockOnIO();
}
}
@Override
public String getVersion() {
if (AuditLogger.isBaseLoggingEnabled()) {

View File

@ -161,6 +161,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
public void testGetAttributes() throws Exception {
ActiveMQServerControl serverControl = createManagementControl();
Assert.assertEquals(server.getConfiguration().getName(), serverControl.getName());
Assert.assertEquals(server.getVersion().getFullVersion(), serverControl.getVersion());
Assert.assertEquals(conf.isClustered(), serverControl.isClustered());

View File

@ -587,6 +587,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
return (Long) proxy.retrieveAttributeValue("transactionTimeoutScanPeriod", Long.class);
}
@Override
public String getName() {
return (String) proxy.retrieveAttributeValue("name");
}
@Override
public String getVersion() {
return proxy.retrieveAttributeValue("version").toString();