278 WebSphere Business Integration Adapters
17.1 Extending the event store class
To define an event store, a connector developer must derive an event-store class
from the CWConnectorEventStore class and must implement some of its
methods for the event store.An
event store is an application’s mechanism for
persistently storing events. For our adapter, we created the RMEventStore class.
Figure 17-1 The class diagram for the RMEventStore
CWConnectorEventStore
CWConnectorAgent
«uses»
RMEventStore
(com.ibm.itso.RedHouse.RM.Adapter)
-connectionPool : com.ibm.itso.RedHouse.RM.Adapter.RMConnectionPool
+fetchEvents() : void
+recoverInProgressEvents() : void
+deleteEvent(String eventID) : void
+setEventStatus(String eventID, int status) : void
+archiveEvents() : void
Chapter 17. Implementing event notification 279
The CWConnectorEventStore class is a base class to provide a Java connector
with the ability to access an event store. The application stores event records in
the event store. The connector retrieves events from the event store and
processes them for transferal to the integration broker.
17.1.1 Implementing methods to in the CWConnectoreEventStore
Table 17-1 summarizes the methods in the CWConnectorEventStore class.
Table 17-1 Member methods of the CWConnectorEventStore class
Important: All Java connectors must extend this class to access the
application’s event store. To access the application’s event store through the
Java CWConnectorEventStore class, implement the following abstract
methods in their derived event-store class:
deleteEvent()
fetchEvents()
setEventStatus()
Member method Description
CWConnectorEventStore() Creates an event-store object.
archiveEvent() Archives the event in the application’s archive
store with the appropriate status.
cleanupResources() Releases resources that the poll method has
used to access the event store.
deleteEvent() Deletes the event from the application’s event
store.
fetchEvents() Retrieves a specified number of Ready-for-Poll
events from the application’s event store.
getBO() Builds a business object based on the
information for an event from the event store.
getNextEvent() Retrieves the next event object from the
eventsToProcess vector.
recoverInProgressEvents() Recovers any in-progress events in the event
store.
resubmitArchivedEvents() Copies the archived event from the
application’s archive store to the event store
and changes the event status to
READY_FOR_POLL.
280 WebSphere Business Integration Adapters
All Java connectors must extend this class to access the event store. To access
the application’s event store through the Java CWConnectorEventStore class,
implement the following abstract methods in their derived event-store class:
deleteEvent()
fetchEvents()
setEventStoreStatus()
To access an archive store, implement the archiveEvent() method.
To provide the ability to recover in-progress events, implement the
recoverInProgressEvents() method.
To provide the ability to resubmit archived events for subsequent polls of the
event store, implement the resubmitArchivedEvents() method.
Example 17-1 shows the skeleton for the RMEventStore class of our custom
adapter. See Figure 17-1 on page 278 for the class diagram.
Example 17-1 The extended RMEventStore class
public class RMEventStore extends CWConnectorEventStore {
public void fetchEvents() throws StatusChangeFailedException {
}
public void recoverInProgressEvents() throws StatusChangeFailedException {
}
public void deleteEvent(String eventID) throws DeleteFailedException {
}
public void setEventStatus(String eventID, int status)
throws InvalidStatusChangeException {
}
public void archiveEvents() throws StatusChangeFailedException {
}
}
setEventStatus() Sets the status of an event in the event store.
setEventsToProcess() Sets the eventsToProcess vector with
specified events.
setTerminate() Sets the internal terminate-connector flag to
true.
updateEventStatus() Updates the event status both in the event
store and in the event.
Note: In the RMAdapter, we do not provide the ability to resubmit archived
events. As a result, we do not implement the resubmitArchiveEvents()
method.
Member method Description

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.