Start of change

Using the Configuration Manager Proxy to deploy

You can use the Configuration Manager Proxy (CMP) for deployment when developing your applications. The following code is an example of the code that you can use in your own applications. It adds a broker called ‘B2’ that is running on queue manager ‘QMB2’ to the domain 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);
			}
		}
	}
}
Using the Configuration Manager Proxy, you can perform all possible types of deployment:
Table 1.
Deployment type Description
TopologyProxy.deploy() Deploys the publish/subscribe topology configuration 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.
See the [insert Javadoc reference here] for more information on how to use each of these methods.

Most deployment methods return an object of type DeployResult, which reveals further information on the deployment. See Checking the results of deployment for more information.

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, to connect to the Configuration Manager, click File > Connect to Configuration Manager. This opens the Connect to Configuration Manager dialog where you enter the relevant connection parameters.


End of change