IBM Integration Bus, Version 9.0.0.8 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 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 IBM® Integration 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/common/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 integration server, because the broker can access these classes independently.
  10. Start of changeIt is best practice to call disconnect() on the BrokerProxy object after you have finished using it. By calling disconnect(), you deregister all listeners that are registered to the BrokerProxy instance and close the link to the broker.End of change

be43730_.htm | Last updated Friday, 21 July 2017