Apama 10.15.0 | Connecting Apama Applications to External Components | Standard IAF Plug-ins | The Database Connector IAF Adapter (ADBC) | The ADBC Event application programming interface | Storing non-event data
 
Storing non-event data
In order to store non-event data in a database, your application needs to use the Connection event's storeData() action. The definition of the storeData() action is:
action storeData(
string tableName,
string statementName,
  dictionary<string,string> fields,
  dictionary<string,string> extraParams) returns integer
The tableName parameter specifies the name of the database table where you want to store the data.
The statementName parameter specifies the name of a StoreStatement that references a prepared statement or stored procedure. The storeStatement is created with the Connection event's createStoreStatement action. See Creating and deleting store events for more information on creating a storeStatement. If you do not want to specify a prepared statement or stored procedure, the statementName parameter should be set to "" (an empty string).
The fields parameter specifies the column values to be stored.
To store an event and provide acknowledgment, implement the storeDataWithAck() action and a callback handler. The definition of the storeDataWithAck() action is:
action storeDataWithAck(
string tableName,
string statementName,
  dictionary<string,string> fields,
string token,
  dictionary<string,string> extraParams,
  action <Connection, string, string> callback)
In addition to the parameters used with the storeData() action, the storeDataWithAck() action includes token and callback parameters. The token parameter specifies a user-defined string to be passed in that will be returned in the callback action. This allows the callback to perform different operations defending on the token value. In this way, a single callback action can perform different operations, eliminating the need to create separate callbacks for each operation. If the token parameter is not needed for the callback, it should be set to "" (an empty string).
The callback parameter specifies the callback action that handles the success or failure of the storeDataWithAck() action. The acknowledgment callback string contains any errors reported as well as the returned token, an empty acknowledgment string indicates success.
If you do not have to take additional action each time a row of data is added to a database table, you can avoid the overhead of receiving acknowledgments by using the storeData() action. If your application needs to handle a failure during a call to the storeData() action, it should call the setStoreErrorCallback action; for more information, see Handling data storing errors.