WebSphere Message Brokers
File: af20125_
Writer: John Morris-Smith

Task topic

This build: July 31, 2007 21:29:25

Using the Configuration Manager Proxy API to deploy

Deploy to the brokers in your broker domain from a CMP application.

You can use the Configuration Manager Proxy API for all possible types of deployment.
Deployment type Description
TopologyProxy.deploy() Deploys the publish/subscribe topology to all affected brokers.
BrokerProxy.deploy() Deploys the broker configuration.
ExecutionGroupProxy.deploy() Deploys a BAR file to an execution group.
TopicRootProxy.deploy() Deploys the topic hierarchy to all brokers.
ConfigManagerProxy.cancelDeployment() Cancels all outstanding deploys in the domain.
BrokerProxy.cancelDeployment() Cancels any outstanding deploy to a specific broker.

The Configuration Manager Proxy API has more information about each of these methods, and you can find an example of the code that you might use for each type of deployment in the appropriate topic in the Deploying section.

You can also check the result of a deployment using the Configuration Manager Proxy API.

An example

This example adds to the domain a broker called B2 that is running on queue manager QMB2 and associates with it an execution group called 'default'. This configuration is then deployed to the broker.

For this example to work successfully, the broker B2 has been created on the machine running queue manager QMB2, and it has not already been deployed to by another Configuration Manager.

import com.ibm.broker.config.proxy.*;

public class AddBroker {

  public static void main(String[] args) {
    ConfigManagerProxy cmp = null;
    try {
      ConfigManagerConnectionParameters cmcp = 
        new MQConfigManagerConnectionParameters(
        "localhost",
        1414,
        "");
      cmp = ConfigManagerProxy.getInstance(cmcp);
    }
    catch (ConfigManagerProxyException cmpex) {
      System.out.println("Error connecting: "+cmpex);
    }
    if (cmp !=null) {
      System.out.println("Connected to Config Manager");
      addBroker(cmp, "B2", "QMB2", "default");
      cmp.disconnect();
    }
  }

  private static void addBroker(ConfigManagerProxy cmp,
                                String bName,
                                String bQMgr,
                                String egName) {
    TopologyProxy topology = null;
    try {
      topology = cmp.getTopology();
    }
    catch(ConfigManagerProxyPropertyNotInitializedException ex) {
      System.err.println("Comms problem! "+ex);
    }
    if (topology != null) {
      try {
        BrokerProxy b2 = topology.createBroker(bName, bQMgr);
        ExecutionGroupProxy e = b2.createExecutionGroup(egName);
        b2.deploy();
      }
      
      catch (ConfigManagerProxyException ex) {
        System.err.println("Could not perform an action: "+ex);
      }
    }
  }
}

Configuration Manager Proxy Exerciser

You can also use the Configuration Manager Proxy Exerciser to deploy. The exerciser is a graphical interface to the Configuration Manager Proxy that allows you to view and manipulate Configuration Manager domains. For example:
  1. Connect to the Configuration Manager: File > Connect to Configuration Manager. This action opens the Connect to Configuration Manager dialog.
  2. Enter the relevant connection parameters in the dialog. A hierarchical representation of the domain is displayed.
  3. You can perform a number of operations. For example:
    • Click an object in the tree to display the attributes of that object.
    • Right-click an object in the tree to invoke Configuration Manager Proxy methods that manipulate that object. For example, right-clicking a broker opens a drop-down menu that has items such as 'start user trace', 'deploy broker configuration' and 'cancel all outstanding deploys to this broker'.
    • Use the log pane at the bottom of the screen to view useful information relating to the operation being performed.
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:29:25

af20125_ This topic's URL is: