Apama 10.15.1 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The Database Connector IAF Adapter (ADBC) | The ADBCHelper application programming interface | Handling acknowledgments
 
Handling acknowledgments
Apama applications can call DBUtil SQL command and query actions as well as commit and rollback actions that request a DBAcknowledgement event. The DBAcknowledgement event indicates the success or failure of the action call. This is useful, for example, to know whether or not a query has completed before performing another application operation.
The DBAcknowledgement event is defined in apama_install_dir\adapters\monitors\ADBCHelper.mon as follows:
event DBAcknowledge
{
integer ackNum;
boolean success;
string error;
}
*ackNum — A unique identifier for the action that requested the acknowledgment.
*success — A value of true indicates success; false indicates failure.
*error — A string describing the specific error.
For action calls that request an acknowledgment, your application needs to do the following:
1. Call an action that requests an acknowledgment, passing in a unique acknowledgment identifier.
2. Create a listener for theDBAcknowledge event that matches the acknowledgment identifier in the calling action.
For example:
integer ackId := integer.incrementCounter("ADBC.ackId");
db.doSQLQueryAck("SELECT * FROM NetworkInformation",
handleNetworkInfo,ackId,false);
//...
on DBAcknowledge(ackNum = ackId) as ack {
if ack.success {
log "Query complete" at INFO;
}
else {
log "Query failed: " + ack.error at ERROR;
die;
}
}
//...