Chapter 17. Implementing event notification 283
}
}
RMLogger.trace(
CWConnectorUtil.LEVEL5,
"Event vector contains " + fetchedEvents.size() + " events");
// sort the vector of event objects
sortEvents(fetchedEvents);
// free up connection from connection pool
connectionPool.releaseConnection(connection);
} catch (AttributeNullValueException e) {
CWConnectorExceptionObject c = new CWConnectorExceptionObject();
c.setMsg("Found null value while retrieving events");
c.setStatus(CWConnectorConstant.FAIL);
throw new StatusChangeFailedException(c);
}
RMLogger.trace(RMLogger.LEVEL4, "Exiting fetchEvents(int, int)");
return fetchedEvents;
}
17.3 Implementing the deleteEvents() method
The deleteEvent() method deletes the event from the event store. This method
is used mainly during archiving. It deletes the event from the event store after this
event has been successfully moved to the application’s archive store.
Important: The deleteEvent() method is an abstract method.Therefore, the
event-store class must implement this method to provide the ability to delete
an event from the event store.
284 WebSphere Business Integration Adapters
Example 17-4 shows the deleteEvents() method implementation for the
RMEventStore.
Example 17-4 The deleteEvents() method.
public void deleteEvent(String eventID) throws DeleteFailedException {
RMLogger.trace(CWConnectorUtil.LEVEL4, "Entering deleteEvent");
// obtain connection from connection pool
RMServerRMIInterface connection;
try {
connection = (RMServerRMIInterface) connectionPool.getConnection();
} catch (Exception e) {
CWConnectorExceptionObject c = new CWConnectorExceptionObject();
c.setMsg("Unable to obtain connection to the application");
c.setStatus(CWConnectorConstant.APPRESPONSETIMEOUT);
throw new DeleteFailedException(c);
}
try {
// delete event from event table
RMDataImplementation aDataImpl =
getRMDataImplementationInstance(eventID);
connection.deleteObject(aDataImpl);
// free up connection from connection pool
connectionPool.releaseConnection(connection);
} catch (Exception e) {
CWConnectorExceptionObject c = new CWConnectorExceptionObject();
c.setMsg("Unable to delete event from the event table");
c.setStatus(CWConnectorConstant.APPRESPONSETIMEOUT);
throw new DeleteFailedException(c);
}
RMLogger.trace(CWConnectorUtil.LEVEL4, "Exiting deleteEvent");
}

Get WebSphere Business Integration Adapters: An Adapter Development and WebSphere Business Integration Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.