1.1.1

Table Of Contents
LISTENERCLASSNAME 'user.application.TestAsyncEventListener'
INITPARAMS ''
) SERVER GROUPS ( SG1 );
Note: You must include the INITPARAMS argument, even if it denes no parameters. If you send user
credentials in the initialization parameters, consider encrypting the password using sqlf encrypt-password
with the external option.
Note: You can optionally install the AsyncEventListener conguration after you associate a table with
the listener name. Make sure that you use the same listener name with both the CREATE
ASYNCEVENTLISTNER command and the CREATE TABLE command.
This example installs TestAsyncEventListener with the identier "MyListener" on members of the server
group "SG1." See CREATE ASYNCEVENTLISTENER for more information about other parameters to the
procedure.
Start the AsyncEventListener Configuration
After you install the AsyncEventListener implementation, you can start it by specifying the unique identier for
the implementation in the SYS.START_ASYNC_EVENT_LISTENER procedure. For example:
java.sql.Connection conn = getConnection();
CallableStatement cs = conn.prepareCall("call
SYS.START_ASYNC_EVENT_LISTENER( ? )");
cs.setString(1, "MyID");
cs.execute();
On execution, a thread would service the queue of the AsyncEventListener and dispatch events to the callback
class.
Associate a Table with an AsyncEventListener Configuration
You associate a table with an AsyncEventListener conguration using the AsyncEventListener clause in
the table's CREATE TABLE statement. For example, to associate the table "TestTable" with an
AsyncEventListenerConguration identied by "MyID" use the statement:
java.sql.Connection conn = getConnection();
Statement stmt = conn.createStatement();
stmt.execute("CREATE TABLE TESTTABLE (ID int NOT NULL, DESCRIPTION
varchar(1024),
ADDRESS varchar(1024) ) AsyncEventListener(MyID) " );
Note: Because the associated listener conguration does not have to be available at the time you create
the table, SQLFire does not display an error message if the specied listener name does not yet exist.
Make sure that you use the same listener name with both the CREATE ASYNCEVENTLISTNER command
and the CREATE TABLE command.
Note: You can optionally associate the table with an AsyncEventListener conguration after you create
the table, using the SQLFire ALTER TABLE statement.
201
Handling DML Events Asynchronously