SOA / Web Services / Java

A Technology Blog

Execution Group properties of a local/remote WMB

Posted by Vivek on September 10, 2011

Those using IBM WMB sometimes face issues when they have to connect to a remote broker and deploy their code to an execution group.  The utility (mqsireportproperties) provided by IBM Websphere Message Broker does not allow to read the properties of a remote broker and it is sometimes not possible to log on to a remote broker machine to execute the mqsireportproperties command. Common problems faced by users in such situation are –

1. User requires MB toolkit/ MQ Explorer 7 to connect to broker and see EG details. It is difficult for a user who does not have these tools on his/her machine.

2. User cannot see/ set the properties like debug port, HTTP port on an execution group.

Most user do not know that they can leverage the ConfiguarionManagerProxy APIs as a workaround mainly because WMB users are not generally java savvy. Here is a utility (Simple Java Program) which will help to set and report the properties on a local or remote broker. It is easy to alter and run from command line.

Prerequisites:

1. Java 6

2. Following jars are added in  classpath – ConfigManagerProxy.jar (located at ../MQSI/7.0/classes), com.ibm.mq.jmqi.jar (located at ../Websphere MQ/Java/lib) and com.ibm.mq.jar (located at …/Websphere MQ/Java/lib)

import java.util.Enumeration;

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

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

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

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

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

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

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

/**

 * This utility connect to a broker and reports the properties on an execution

 * group.

 *

 * @author vivek

 *

 */

public class EGStatusReport {

      public static void main(String args[]) {

            try {

                  BrokerConnectionParameters bcp = new MQBrokerConnectionParameters(

                              “localhost”, 1425, “MYQMGR”);

                  BrokerProxy b = BrokerProxy.getInstance(bcp);

                  Enumeration<ExecutionGroupProxy> listEG = b

                              .getExecutionGroups(null);

                  while (listEG.hasMoreElements()) {

                        ExecutionGroupProxy egIter = listEG.nextElement();

                        // Get Execution Group Name

                        System.out

                                    .println(“Execution Group Name – ” + egIter.getName());

                        //GetDebugPort

                        System.out.println(“Debug Port of EG – ”

                                    + egIter.getDebugPort());

                        //GetHTTPPort

                        System.out.println(“HTTP port enabled on EG – ”

                                    + egIter.getRuntimeProperty(“HTTPConnector/port”));

                        // Get List of Message Flows and their details

                        Enumeration<MessageFlowProxy> listMsgFlow = egIter

                                    .getMessageFlows(null);

while (listMsgFlow.hasMoreElements()) {

                              MessageFlowProxy msgFlow = listMsgFlow.nextElement();

                              // Get name of message flow

                              System.out.println(“Messsage Flow Name – ”

                                          + msgFlow.getName());

                              // Get BAR File Name

                              System.out.println(“BAR File Name – ”

                                          + msgFlow.getBARFileName());

                              // Get time of deployment

                              System.out.println(“Deployed at – ”

                                          + msgFlow.getDeployTime());

                              // Get run status of Message Flow

                              System.out.println(“Is run enabled? – ”

                                          + msgFlow.isRunEnabled());

                        }

                        // Get number of deployed objects

                        System.out.println(“No of deployed objects – ”

                                    + egIter.getDeployedObjectsCount(null));

                  }

            } catch (ConfigManagerProxyLoggedException e) {

                  e.printStackTrace();

            } catch (ConfigManagerProxyPropertyNotInitializedException e) {

                  e.printStackTrace();

            }

      }

}

Refer to the following URL for complete list of methods: 

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.cmp.doc%2Fcom%2Fibm%2Fbroker%2Fconfig%2Fproxy%2Fpackage-overview.html

Advertisements

One Response to “Execution Group properties of a local/remote WMB”

  1. syam said

    This is great script, helps me to get UUID for my EGs, but some reason the message flows are not getting displayed
    Looks like this is not getting the list from EG
    // Get List of Message Flows and their details
    Enumeration listMsgFlow = egIter
    .getMessageFlows(null);
    As you said, I am guru in IIB but blank in JAVA.
    can you help why getMessageFlows(null) doesn’t return any flows deployed in that EG?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: