How the AsyncEventListener Works

An AsyncEventListener instance is serviced by its own dedicated thread in which a callback method is invoked. Events that correspond to DML operations are placed in an internal queue, and the dedicated thread dispatches a batch of events at a time to the user-implemented callback class. The frequency of dispatching events is governed by the configuration of the AsyncEventListener in SQLFire.

To receive DML callbacks, you create a class that implements the http://www.vmware.com/support/developer/vfabric-sqlfire/103-api/com/vmware/sqlfire/callbacks/AsyncEventListener.html interface.

The callback method processEvents(List<Event> events) provides information related to manipulated rows, such as the new row values. The Event object provides following information.
Event Information Description
Type of Event Object of Enumeration Type. It could be AFTER_INSERT, AFTER_UPDATE, AFTER_DELETE, depending upon the type of CRUD operation.
Old Row List of objects representing the tuple, before modification.
New Row List of objects, representing the tuple after modification.
ResultSetMetaData Object of java.sql.ResultSetMetaData interface providing information about the type and properties of the columns.
Modified Columns An int array containing the positions of the columns that were updated. The details of the modified columns can be retrieved from the metadata from ResultSetMetaData. The modified column values can be obtained from the new wow from using index as column.
Primary Key Object array representing the primary key of the manipulated row. If the table has no primary key defined, then a long value uniquely identifying the row would be returned. In such cases, users can correlate the row ID during creation with that during update & delete.
Note: Certain data consistency problems can occur if multiple threads update data that is queued to an AsyncEventListener implementation. See No Ordering Guarantee for DML in Separate Threads.