WebSphere Message Broker, Version 8.0.0.7 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

Working with properties of a configurable service of type UserDefined at run time in a JavaCompute node

Use the CMP API in a JavaCompute node to query, set, create, and delete properties dynamically at run time in configurable services that you have defined with type UserDefined.

Before you start:
Complete the following tasks.
If you have created a UserDefined configurable service, and created properties for that service, you can work with those properties in a JavaCompute node. For example, you can create a UserDefined configurable service to set timeouts for processing HTTP messages.

You can create and delete configurable services in JavaCompute nodes, in the WebSphere® Message Broker Explorer, and by using the mqsicreateconfigurableservice and mqsideleteconfigurableservice commands.

  1. Right-click the JavaCompute node and click Open Java to create and open a Java™ file in the Editor view, or open an existing file.
  2. Create the Java class for the node in which you want to include CMP methods.
  3. Add the CMP JAR file install_dir/classes/ConfigManagerProxy.jar to the Java build path for the associated Java project.
  4. Import com.ibm.broker.config.proxy.* in your code.
  5. Add the following static method to the class you have created:
    BrokerProxy b = BrokerProxy.getLocalInstance();

    This method returns an instance of the BrokerProxy object for the broker to which the message flow (that contains this node) is deployed.

  6. To ensure that the BrokerProxy object has been populated with data from the broker before you access the configurable service, add the following code:
    while(!b.hasBeenPopulatedByBroker()) { Thread.sleep(100); } 
  7. Access the appropriate UserDefined configurable service:
    1. If you know the name of the configurable service, use the following code to access it:
      ConfigurableService myUDCS = b.getConfigurableService("UserDefined", "UD1");
    2. If you want to select from a set of UserDefined configurable services, use the following code to get a list of all services of a particular type:
      ConfigurableService[] UD_set = b.getConfigurableServices("UserDefined");
  8. Add further code to access and use the specific properties that you are interested in. For example:
    • Retrieve the properties that are defined to that service:
      String[] props = myUDCS.getProperties();
    • Create a new property:
      String newprop = 'VerifyRequestTimeout';
      String newval = '15';
      myUDCS.setProperty(newprop, newval);
    • Delete a property:
      myUDCS.deleteProperty(newprop);
      You can also use the deleteProperties() method to delete more than one property.

      You can delete properties in UserDefined configurable services only. If you use this method on a configurable service of a different type, a ConfigManagerProxyLoggedException is generated.

  9. Deploy the JAR file, and all associated message flows, in a BAR file. You do not have to deploy the ConfigManagerProxy.jar file to the target execution group, because the broker can access these classes independently.
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2016Copyright IBM Corporation 1999, 2016.

        
        Last updated:
        
        Last updated: 2016-05-23 14:48:06


Task topicTask topic | Version 8.0.0.7 | be43730_.dita