Broker 10.15 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Managing Broker Clients | Broker Client Administration | Disconnecting by Session Identifier
 
Disconnecting by Session Identifier
A Broker client can share its client state, which means that several client applications can create BrokerClient objects using the same client identifier. In these cases, each client application's connection is represented by a BrokerClientSession object with a unique session identifier.
The following example shows how you can disconnect a single Broker client session by invoking the BrokerAdminClient.disconnectClientSessionById method.
. . .
BrokerAdminClient c;
BrokerClientInfo inf;
int i;
try {
/* Create a Broker admin client */
c = new BrokerAdminClient(broker_host, broker_name, null,
client_group, "My Broker Monitor",null);
/* Get the information for a particular Broker client */
inf = c.getClientInfoById("A123");
/* Get the session ID of the client with an IP
* address of 101.111.12.1
*/
for( i = 0; i < inf.sessions.length; i++) {
if( inf.sessions[i].ip_address == 0x656f0c01) {
/* Disconnect the Broker client by session identifier */
c.disconnectClientBySessionId("A123",
inf.sessions[i].session_id);
}
}
} catch (BrokerException ex) {
System.out.println("Error while disconnecting BrokerClient by session\n"
+ex);
return;
}
. . .