Finding Broker queue length

Hello All,

Is there any std build-in service available for the fetching the broker queue length?

Also just want know,is there any way to see the source code of the inbuild java service in webmMethods?


import COM.activesw.api.client.*;
public class QueueCheck
public static void main(String args[])
String broker_host = args[0];
String broker_name = args[1];
String client_group = args[2];
String client_state_name = args[3];
BrokerClient bc;
BrokerEvent e[], evt[];
BrokerConnectionDescriptor bcd;
boolean shared = true;
long sq_no;
int i = 0;
int len = 0;
//create a broker connection descriptor
bcd = new BrokerConnectionDescriptor();
//create a broker client
try {
bc = BrokerClient.newOrReconnect(broker_host,broker_name,client_state_name,
System.out.println(“Test Brokerclient connected”);
} catch(BrokerException ex) {
System.out.println(“Error on creating a broker client\n” + ex);
}//create broker client

//get the que Length
try {
    len = bc.getQueueLength();
    System.out.println("Number of events in the queue: " + len);
} catch(BrokerException ex) {
}//get que length

//retreive the events
e = new BrokerEvent[len];
evt = new BrokerEvent[len];
      try {
            e = bc.getEvents(1, -1, 6000);
            evt[i] = e[0];
            System.out.println("Received " + evt[i].getTypeName() + " event");
            System.out.println("" + evt[i]);
      } catch(BrokerException ex) {
           System.out.println("getEvents() not successful...\n" + ex);

//disconnect the brokerClient
try {
       System.out.println("Disconnected TestSubscriber brokerClient");
} catch(BrokerException ex) {
     System.out.println("Error on destroying the broker client\n" + ex);


Hi Malani,

Can we use this code as Java Service.
If yes
which package do i need to import in shared tab?
Do i need to create broker client in code?
What will be the input if i am using this code as java service.

Actually i tried using this code as java service, but no luck :frowning:

Your quick response will be highly appreciated.

Mangat Rai

Yes this can be used as java service.
You need to import COM.activesw.api.client.* package

Can any one please let me know wthether broker queue length is same as broker queue depth.