Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Load Balancing and Failover for Publish Operations | Using BrokerClusterPublisher | Creating and Destroying BrokerClusterPublisher | Creating a BrokerClientPublisher
 
Creating a BrokerClientPublisher
Your application can create a BrokerClientPublisher by calling the BrokerClusterPublisher constructor and specifying these parameters.
*The name of the host where the Broker to which you want to connect is executing.
*The name of the Broker to which you want to connect. You can specify a null value if you want to connect to the default Broker. The default Broker for a particular host is determined by your webMethods Broker administrator.
*A unique client ID that identifies your application Broker clients. This identifier cannot be null.
*The client group for your application Broker clients. This client group defines the event types your BrokerClusterPublisher can publish or retrieve, as well as the life cycle and queue storage type for your application Broker clients. Client groups are defined by the webMethods Broker administrator.
*The name of the application that is creating the BrokerClusterPublisher. This name is used primarily by webMethods Broker administration tools. The application name can be any meaningful string of characters of your choosing.
*A BrokerClusterPublisher to be used for the application Broker clients. If you specify a null value, a default connection descriptor will be created for you.
*A BrokerClusterPublisher class to be used for the cluster monitor client. If you specify a null value, a default connection descriptor will be created fro you.
A Broker client belonging to eventLog client group, known as the Cluster Monitor Client, is created to the Broker as specified by the constructor parameters. BrokerClusterPublisher discovers other Brokers on the territory via this Cluster Monitor Client and establishes a Broker client connection to each of these Brokers.
Note:BrokerConnectionDescriptor properties such as state sharing, connection sharing, automatic reconnect and other features except the Access Labels and SSL related are ignored for BrokerClusterPublisher.
The following example contains an excerpt from a sample application that shows the creation of a new BrokerClusterPublisher object.
Import COM.activesw.api.client.*;
 
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 = new BrokerClusterPublisher(broker_host, broker_name,
"ClusterPub", client_group, "Cluster Publish Sample #1",null,
null);
} catch (BrokerException ex) {
System.out.println("Error on create cluster publisher\n"+ex);
return;
}
. . .