Discarding pending events from an outbound endpoint

You can use the discardPendingOutboundEvents MBean method to discard any pending events for an outbound endpoint.

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 discard all pending events from an outbound endpoint 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. Discard all the pending events from the outbound endpoint by using the emptySolutionEndpoint MBean.
    discardPendingOutboundEvents():
    
    try {
    MBeanServerConnection connection = getConnection(hostName, port, adminUsername, adminPassword, trustStorePath, trustStorePassword);
    
    connection.invoke(new ObjectName("com.ibm.ia:type=OutboundBufferManager"), "discardPendingOutboundEvents", new Object[] {solutionName, endpointName}, new String[] {String.class.getName(), String.class.getName()});
    
    } catch (JMXException e) {
    e.printStackTrace();
    }