Chapter 8. Asynchronous event processing and notification 115
The SQL statement Example 8-1 shows how a connector might select event
records based on event priority. The SELECT statement sorts the events by
priority, and the connector processes each event in turn.
Example 8-1 Example SQL statement
SELECT event_id, object_name, object_verb, object_key
FROM event_table
WHERE event_status = 0 ORDER BY event_priority
8.3.6 Event distribution
The polling mechanisms can be implemented so that multiple connectors can
poll the same event store. Each connector can be configured to process certain
events, create specific business objects, and pass those business objects to
broker system. This configuration can streamline the processing of certain types
of events and increase the transfer of data out of an application.
To implement event distribution so that multiple connectors can poll the event
store, complete the following steps:
1. Add a column to the event record for an integer connector identifier (ID), and
design the event detection mechanism to specify which connector will pick up
the event. This might be done per application entity. For example, the event
detection mechanism might specify that all Customer events be picked up by
the connector that has the connectorId field set to 4.
2. Add an application-specific connector property named ConnectorId. Assign
each connector a unique identifier and store this value in its ConnectorId
property.
Implement the poll method to query for the value of the ConnectorId property. If
the property is not set, the poll method can retrieve all event records from the
event store as usual. If the property is set to a connector identifier value, the poll
method retrieves only those events that match the ConnectorId property.
8.4 Custom pollForEvents() method
For a Java connector, the CWConnectorAgent class defines the
pollForEvents() method. This class provides a default implementation of the
pollForEvents() method. You can use this default implementation or override
the method with your own poll method. However, the pollForEvents() method
must be implemented.