Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Load Balancing and Failover for Publish Operations | Using BrokerClusterPublisher | Using the newOrReconnect method
Using the newOrReconnect method
You might find it convenient to use the BrokerClusterPublisher.reconnect method to create or reconnect a client when your client application is expected to be executed repeatedly. The newOrReconnect method will attempt to create a BrokerClusterPublisher. If the Broker cluster publishers already exist and was simply disconnected, it will be reconnected.
class ClusterPublish1
static String broker_host = "localhost";
static String broker_name = null;
static String client_group = "default";
. . .
public static void main(String args[])
BrokerClusterPublisher bcp;
. . .
/* Create */
try {
bcp = BrokerClusterPublisher.newOrReconnect(broker_host,
broker_name, "ClusterPub", client_group, "Cluster
Publish Sample #1",null, null);
} catch (BrokerException ex) {
System.out.println("Error on newOrReconnect cluster publisher\n"+ex);
. . .