Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Load Balancing and Failover for Publish Operations | Publishing and Delivering Events | Include-Exclude Brokers
 
Include-Exclude Brokers
At the creation time, the cluster monitor discovers the Brokers on the territory and BrokerClusterPublisher creates BrokerClient connections to these Brokers with the specified application settings. A territory can contain a mixture of Brokers from different versions of webMethods Broker. BrokerClusterPublisher can utilize Brokers from version webMethods Broker 6.0 or higher. All other Brokers are automatically excluded from the cluster operations; therefore, BrokerClusterPublisher automatically excludes pre-6.0 version Brokers at creation time.
You can also exclude or include a specific Broker from cluster operations by invoking BrokerClusterPublisher.excludeBroker method and BrokerClusterPublisher.includeBroker method respectively. If you discover that a set of Brokers have less of a load or the Broker host has more resources than others, you might want to reroute all operations to a specific set of Brokers on the territory.
The following example illustrates how to use BrokerClusterPublisher().exclude and include methods:
public static void main(String args[])
{
BrokerClusterPublisher bcp;
BrokerEvent e, events[];
int i;
. . .
/* create BrokerClusterPublisher */
. . .
/* create the request event to be sent and set the event fields */
. . .
/* When you find that the broker b1 is overloaded and you want to exclude
the broker from the cluster operations */
try {
bcp.excludeBroker(b1@localhost);
} catch (BrokerException ex) {
. . .
}
. . .

/* When you find that the broker b1 has returned to normal and you want to
include the broker for future cluster operations */
try {
bcp.includeBroker(b1@localhost);
} catch (BrokerException ex) {
. . .
}
. . .
When a Broker is excluded from on a BrokerClusterPublisher, the Broker client connection to that Broker from the Broker cluster publisher pool is removed immediately so that the Broker client connection can no longer be used. Similarly, after you include the Broker for cluster operations, a new Broker client connection is created so that Broker and future operations will utilize this connection.