This is part of the larger task of developing Configuration Manager Proxy (CMP) applications.
The following example adds a broker called B2, that is running on queue manager QMB2, to the domain and associates with it an execution group called default. Finally, this configuration is deployed to the broker.
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); } } } }
The critical statements in this example are the three lines inside the try block towards the end of the addBroker() method. The first statement attempts to add the broker to the Configuration Manager’s topology, the second attempts to create the default execution group, and the third attempts to deploy the configuration (that is, the new execution group) to the broker.
Note that the createBroker() method assumes that the "physical" broker component has already been created using the mqsicreatebroker command.
Because requests are processed asynchronously by the Configuration Manager, the BrokerProxy object that is returned from the createBroker() method is a "skeleton" object when returned to your application, as it refers to an object that may not yet exist on the Configuration Manager.
This is also true of the ExecutionGroupProxy object e returned from the createExecutionGroup() method. In both cases, the object can be manipulated by the application as if it existed on the Configuration Manager, although the actual creation of the underlying object might not happen for some time.
Once the object represented by the skeleton is created in the Configuration Manager, any requests that refer to it can be processed. In this example, once the broker has actually been added to the topology in the Configuration Manager, the Configuration Manager can honor the request to create the execution group.
If, for any reason the request to create the object described by the skeleton fails, any requests that use the skeleton also fails. So, if broker B2 can not be created, any requests involving the skeleton BrokerProxy object b2, that is, b2.createExecutionGroup() and b2.deploy() also fail. However, the CMP application works, as in the successful case, as no exception is thrown. See Checking the results of broker domain management using the Configuration Manager Proxy for further information on how to detect problems such as these.
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ae33100_ |