Obtaining Broker Client Identifiers
The BrokerAdminClient.getClientIds method lets you obtain a list of all client identifiers known to the Broker to which your BrokerAdminClient is connected and to which your client has access.
The following example illustrates how to list all client identifiers for a Broker:
. . .
int i;
String client_ids[];
BrokerAdminClient c;
try {
/* Create a Broker admin client */
c = new BrokerAdminClient(broker_host, broker_name, null,
client_group, "My Broker Monitor",null);
/* Get a list of all client ids for this Broker and print them out*/
client_ids = c.getClientIds();
for(i = 0; i < client_ids.length; i++) {
System.out.println(client_ids[i]);
}
} catch (BrokerException ex) {
System.out.println("Error getting Client Id list\n"+ex);
return;
}
. . .
The BrokerAdminClient.getClientIdsByClientGroup method lets you obtain a list of all client identifiers belonging to the client group which you specify and to which your client has access. The following example illustrates how to list all client identifiers for a client group:
. . .
int i;
String client_ids[];
BrokerAdminClient c;
try {
/* Create a Broker admin client */
c = new BrokerAdminClient(broker_host, broker_name, null,
client_group, "My Broker Monitor",null);
/* List of all client ids for this client group and print them out*/
client_ids = c.getClientIdsByClientGroup("myGroup");
for(i = 0; i < client_ids.length; i++) {
System.out.println(client_ids[i]);
}
} catch (BrokerException ex) {
System.out.println("Error while getting the Client ID list\n"+ex);
return;
}
. . .
The BrokerAdminClient.getClientIdsWhichAreSubscribed method lets you obtain a list of all the client identifiers which have subscribed to a particular event type and to which your client has access. The following example illustrates how to list all client identifiers subscribed to an event type:
. . .
int i;
String client_ids[];
BrokerAdminClient c;
try {
/* Create a Broker admin client */
c = new BrokerAdminClient(broker_host, broker_name, null,
client_group, "My Broker Monitor",null);
/* Get a list of all the client IDs that are subscribed and print them out*/
client_ids = c.getClientIdsWhichAreSubscribed("myEvent");
for(i = 0; i < client_ids.length; i++) {
System.out.println(client_ids[i]);
}
} catch (BrokerException ex) {
System.out.println("Error while getting the Client ID list\n"+ex);
return;
}
. . .