Listing outbound endpoints

You can use the listOutboundEndpointBuffers MBean method to get a summary of the outbound endpoints for one or more solutions, including the number of pending events. You use the values returned by this method as inputs to the getPendingOutboundEventCount and discardPendingOutboundEvents methods.

About this task

You can access Liberty server attributes and complete various server operations by using a Java™ Management Extensions (JMX) management bean (MBean). The Liberty server profile provides MBeans and corresponding management interfaces that you can use to manipulate and monitor the server.

Use the outbound connectivity MBean, com.ibm.ia:type=OutboundBufferManager, to list the outbound endpoints for a solution. The management interface for the MBean is com.ibm.ia.connectivity.management.OutboundBufferManagerMXBean.

After you create an MBeanServer instance for the Decision Server Insights application that is running on the Liberty profile, you can access the attributes or call the operations of the MBeans. Activate the MBean interface by calling the javax.management.JMX.newMXBeanProxy method, which enables the MXBeans to obtain a proxy object.

Procedure

  1. Connect to the MBean server and create an MBeanServer instance for the Decision Server Insights application code that is running on the Liberty profile. See the Administrator toolkit topic for an example of the MBean server connection code.
  2. List the solution outbound endpoints by using the listOutboundEndpointBuffers MBean.
    listOutboundEndpointBuffers():
    
    try {
    	MBeanServerConnection connection = getConnection(hostName, port, adminUsername, adminPassword, trustStorePath, trustStorePassword);
    
    	Object map = connection.invoke(new ObjectName("com.ibm.ia:type=OutboundBufferManager"), "listOutboundEndpointBuffers", new Object[]{solutionName, eventCountFilter, 		includeUnusedEndpointsOnly}, new String[]{String.class.getName(), Long.class.getName(), Boolean.class.getName()});
    
    	if (map != null) {
    		Map<String, Map<String, Long>> solutionEndpoints = (Map<String, Map<String, Long>>)map;
    
    		for (String solution : solutionEndpoints.keySet()) {
    			System.out.println("Outputting endpoint buffers for solution: "+solution);
    			
    			Map<String, Long> buffers = solutionEndpoints.get(solution);
    
    			for (String buffer : buffers.keySet()) {
    				System.out.println("Buffer "+buffer+" found with depth "+buffers.get(buffer));
    			}
    		}
    	}
    } catch (JMXException e) {
    	e.printStackTrace();
    }