Broker 10.5 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Managing Brokers and Broker Servers | Managing a Broker Server Configuration | Getting Broker Server Statistics
 
Getting Broker Server Statistics
You can use the BrokerServerClient.getStats method to obtain statistics for the Broker Server to which your BrokerServerClient is connected. The statistics are returned as fields within a BrokerEvent.
After you have obtained the BrokerEvent containing the statistics, you can retrieve each field using the appropriate BrokerEvent.get<type>Field method. The following example illustrates how to obtain and parse the BrokerEvent containing the Broker Server's statistics.
. . .
int num_connections;
boolean low_disk_space;
BrokerEvent e;
BrokerServerClient c;
try {
/* Create a Broker Server client */
c = new BrokerServerClient(broker_host, null);
 
/* Get the BrokerEvent containing the Broker Server’s statistics */
e = c.getStats();
/* Get the total number of connections */
num_connections = e.getIntegerField( "numConnections");
/* Get the disk space status */
low_disk_space = e.getBooleanField( "isDiskSpaceLow");
. . .
} catch (BrokerException ex) {
System.out.println("Error getting host statistics\n"+ex);
return;
}
. . .