Apama Documentation : Connecting Apama Applications to External Components : Using Standard Adapters : Using the Apama Database Connector : 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 an instance of the com.apama.database.DBAcknowledge event.
3. Create a listener for theDBAcknowledge event that matches the acknowledgment identifier in the calling action.
For example:
integer ackId := integer.getUnique();
db.doSQLQueryAck("SELECT * FROM NetworkInformation",
handleNetworkInfo,ackId,false);
com.apama.database.DBAcknowledge ack;
//...
on DBAcknowledge(ackNum = ackId) : ack {
if ack.success then {
log "Query complete" at INFO;
}
else {
log "Query failed: " + ack.error at ERROR;
die;
}
}
//...
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback