AMQ-4760: Added dstat command to activemq karaf commands.

This commit is contained in:
Claus Ibsen 2013-10-01 16:19:19 +02:00
parent a80a1857d0
commit ee8b51b27b
2 changed files with 151 additions and 125 deletions

View File

@ -81,13 +81,13 @@ public class DstatCommand extends AbstractJmxCommand {
}
}
private void displayAllDestinations() throws IOException, Exception {
private void displayAllDestinations() throws Exception {
String query = JmxMBeansUtil.createQueryString(queryString, "*");
List<?> queueList = JmxMBeansUtil.queryMBeans(createJmxConnection(), query);
final String header = "%20s %10s %10s %10s %10s";
final String tableRow = "%20s %10d %10d %10d %10d";
final String header = "%-60s %10s %10s %10s %10s";
final String tableRow = "%-60s %10d %10d %10d %10d";
context.print(String.format(Locale.US, header, "Name", "Pending", "Consumers", "Enqueued", "Dequeued"));
@ -106,13 +106,13 @@ public class DstatCommand extends AbstractJmxCommand {
}
}
private void displayQueueStats() throws IOException, Exception {
private void displayQueueStats() throws Exception {
String query = JmxMBeansUtil.createQueryString(queryString, "Queue");
List<?> queueList = JmxMBeansUtil.queryMBeans(createJmxConnection(), query);
final String header = "%20s %10s %10s %10s %10s";
final String tableRow = "%20s %10d %10d %10d %10d";
final String header = "%-60s %10s %10s %10s %10s";
final String tableRow = "%-60s %10d %10d %10d %10d";
context.print(String.format(Locale.US, header, "Name", "Pending", "Consumers", "Enqueued", "Dequeued"));
@ -131,13 +131,13 @@ public class DstatCommand extends AbstractJmxCommand {
}
}
private void displayTopicStats() throws IOException, Exception {
private void displayTopicStats() throws Exception {
String query = JmxMBeansUtil.createQueryString(queryString, "Topic");
List<?> topicsList = JmxMBeansUtil.queryMBeans(createJmxConnection(), query);
final String header = "%20s %10s %10s %10s";
final String tableRow = "%20s %10d %10d %10d";
final String header = "%-60s %10s %10s %10s";
final String tableRow = "%-60s %10d %10d %10d";
context.print(String.format(Locale.US, header, "Name", "Consumers", "Enqueued", "Dequeued"));

View File

@ -27,7 +27,7 @@
<property name="actionId" value="listaction"/>
</bean>
<service ref="listcommand" activation="lazy" >
<service ref="listcommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
@ -53,7 +53,7 @@
<property name="actionId" value="queryaction"/>
</bean>
<service ref="querycommand" activation="lazy" >
<service ref="querycommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
@ -79,7 +79,7 @@
<property name="actionId" value="browseaction"/>
</bean>
<service ref="browsecommand" activation="lazy" >
<service ref="browsecommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
@ -105,7 +105,7 @@
<property name="actionId" value="bstataction"/>
</bean>
<service ref="bstatcommand" activation="lazy" >
<service ref="bstatcommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
@ -131,7 +131,7 @@
<property name="actionId" value="purgeaction"/>
</bean>
<service ref="purgecommand" activation="lazy" >
<service ref="purgecommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
@ -150,4 +150,30 @@
</property>
</bean>
<!-- ActiveMQ Dstat Command -->
<bean id="dstatcommand" class="org.apache.activemq.karaf.commands.ActiveMQCommand">
<property name="blueprintContainer" ref="blueprintContainer"/>
<property name="blueprintConverter" ref="blueprintConverter"/>
<property name="actionId" value="dstataction"/>
</bean>
<service ref="dstatcommand" activation="lazy">
<interfaces>
<value>org.apache.felix.service.command.Function</value>
<value>org.apache.karaf.shell.console.CompletableFunction</value>
</interfaces>
<service-properties>
<entry key="osgi.command.scope" value="activemq"/>
<entry key="osgi.command.function" value="dstat"/>
</service-properties>
</service>
<bean id="dstataction" class="org.apache.activemq.karaf.commands.ActiveMQCommandSupport"
activation="lazy"
scope="prototype">
<property name="command">
<bean class="org.apache.activemq.console.command.DstatCommand"/>
</property>
</bean>
</blueprint>