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 resource statistics in a CMP application

Start, stop, and review status of resource statistics collection in your CMP applications.

Before you start:
You can create CMP applications to examine and control the collection of resource statistics.
Checking what resource types can return statistics
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and writes out available
// resource types on the broker that have the 
// ability to emit resource-level statistics. 
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	String[] resourceNames = b.getResourceTypeNames();
	for (String thisResource : resourceNames) {
		System.out.println(thisResource);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Checking for resource names associated with a specific resource type
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and writes out resource property
// names reported for a specific resource type.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	String[] resourcePropertyNames = 
				b.getResourceTypeStatisticsPropertyNames("JVM");
	for (String thisResourceProperty : resourcePropertyNames) {
		System.out.println(thisResourceProperty);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Starting statistics collection
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then enables resource 
// statistics for all the integration server's resource types.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		eg.setResourceStatisticsEnabled(null, true);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Stopping statistics collection
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then disables resource 
// statistics for all the integration server's resource types.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		eg.setResourceStatisticsEnabled(null, false);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Viewing statistics collection status
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then writes out if resource 
// statistics is enabled.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		System.out.println(eg.getResourceStatisticsEnabled(null));
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}

be43390_.htm | Last updated Friday, 21 July 2017