This closes #4228
This commit is contained in:
commit
9c851f9605
|
@ -2984,4 +2984,12 @@ public interface AuditLogger extends BasicLogger {
|
|||
@LogMessage(level = Logger.Level.INFO)
|
||||
@Message(id = 601764, value = "User {0} is calling deliverScheduledMessage on queue: {1} {2}", format = Message.Format.MESSAGE_FORMAT)
|
||||
void deliverScheduledMessage(String user, Object source, Object... args);
|
||||
|
||||
static void getStatus(Object source, Object... args) {
|
||||
BASE_LOGGER.getStatus(getCaller(), source);
|
||||
}
|
||||
|
||||
@LogMessage(level = Logger.Level.INFO)
|
||||
@Message(id = 601765, value = "User {0} is getting status on target resource: {1}", format = Message.Format.MESSAGE_FORMAT)
|
||||
void getStatus(String user, Object source);
|
||||
}
|
||||
|
|
|
@ -521,6 +521,9 @@ public interface ActiveMQServerControl {
|
|||
@Attribute(desc = "The runtime size of the authorization cache")
|
||||
long getAuthorizationCacheSize();
|
||||
|
||||
@Attribute(desc = "The current status in JSON format")
|
||||
String getStatus();
|
||||
|
||||
// Operations ----------------------------------------------------
|
||||
@Operation(desc = "Isolate the broker", impact = MBeanOperationInfo.ACTION)
|
||||
boolean freezeReplication();
|
||||
|
|
|
@ -1430,4 +1430,11 @@ public interface Configuration {
|
|||
default String resolvePropertiesSources(String propertiesFileUrl) {
|
||||
return System.getProperty(ActiveMQDefaultConfiguration.BROKER_PROPERTIES_SYSTEM_PROPERTY_NAME, propertiesFileUrl);
|
||||
}
|
||||
|
||||
String getStatus();
|
||||
|
||||
/** This value can reflect a desired state (revision) of config. Useful when configurationFileRefreshPeriod > 0
|
||||
Eventually with some coordination we can update it from various server components. */
|
||||
// Inspired by https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#:~:text=The%20status%20describes%20the%20current,the%20desired%20state%20you%20supplied
|
||||
void setStatus(String status);
|
||||
}
|
||||
|
|
|
@ -401,6 +401,7 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
* Parent folder for all data folders.
|
||||
*/
|
||||
private File artemisInstance;
|
||||
private String status;
|
||||
|
||||
@Override
|
||||
public String getJournalRetentionDirectory() {
|
||||
|
@ -2848,6 +2849,16 @@ public class ConfigurationImpl implements Configuration, Serializable {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
// extend property utils with ability to auto-fill and locate from collections
|
||||
// collection entries are identified by the name() property
|
||||
private static class CollectionAutoFillPropertiesUtil extends PropertyUtilsBean {
|
||||
|
|
|
@ -4490,6 +4490,16 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
if (AuditLogger.isBaseLoggingEnabled()) {
|
||||
AuditLogger.getStatus(this.server);
|
||||
}
|
||||
checkStarted();
|
||||
|
||||
return server.getConfiguration().getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetUser(String username, String password, String roles, boolean plaintext) throws Exception {
|
||||
if (AuditLogger.isBaseLoggingEnabled()) {
|
||||
|
|
|
@ -964,4 +964,8 @@ public interface ActiveMQServer extends ServiceComponent {
|
|||
|
||||
default void setProperties(String fileUrltoBrokerProperties) {
|
||||
}
|
||||
|
||||
default String getStatus() {
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -838,6 +838,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
|
|||
return (Long) proxy.retrieveAttributeValue("AuthorizationCacheSize", Long.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return (String) proxy.retrieveAttributeValue("Status", String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDiskStoreUsage() {
|
||||
try {
|
||||
|
|
|
@ -87,6 +87,7 @@ public class ConfigurationTest extends ActiveMQTestBase {
|
|||
|
||||
config.put("addressConfigurations.mytopic_3.queueConfigs.\"queue.B3\".address", "mytopic_3");
|
||||
config.put("addressConfigurations.mytopic_3.queueConfigs.\"queue.B3\".routingType", "MULTICAST");
|
||||
config.put("status","{\"generation\": \"1\"}");
|
||||
|
||||
try (FileOutputStream outStream = new FileOutputStream(propsFile)) {
|
||||
config.store(outStream, null);
|
||||
|
@ -112,6 +113,7 @@ public class ConfigurationTest extends ActiveMQTestBase {
|
|||
|
||||
// add new binding from props update
|
||||
config.put("addressConfigurations.mytopic_3.queueConfigs.\"queue.C3\".address", "mytopic_3");
|
||||
config.put("status","{\"generation\": \"2\"}");
|
||||
|
||||
try (FileOutputStream outStream = new FileOutputStream(propsFile)) {
|
||||
config.store(outStream, null);
|
||||
|
@ -122,6 +124,9 @@ public class ConfigurationTest extends ActiveMQTestBase {
|
|||
return mytopic_31.getBindings().size() == 3;
|
||||
});
|
||||
|
||||
// verify round trip apply
|
||||
Assert.assertTrue(server.getActiveMQServerControl().getStatus().contains("2"));
|
||||
|
||||
} finally {
|
||||
try {
|
||||
server.stop();
|
||||
|
|
Loading…
Reference in New Issue