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 event data
 
Storing event data
In order to store an event in a database, your application needs to use the Connection event's storeEvent action. The definition of the storeEvent action is:
action storeEvent(
  float timestamp,
  string eventString,
string tableName,
string statementName,
string timeColumn,
  dictionary<string,string> extraParams) returns integer
The getTime() call on the event is used to set the timestamp value.
Similarly, the toString() call on an event sets the eventString field.
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 timeColumn parameter specifies the column in the database where you want the event timestamp to be stored.
The storeEvent action returns an integer value, which is the identifier for the event being stored. The setStoreErrorCallback action is used to specify an action to be used when an error is reported.
To store an event and provide acknowledgment, implement the storeEventWithAck() action and a callback handler. The definition of the storeEventWithAck action is:
action storeEventWithAck(
  float timestamp,
  string eventString,
string tableName,
string statementName,
string timeColumn,
string token,
  dictionary<string,string> extraParams,
  action <Connection, string, string> callback)
In addition to the parameters used with the storeEvent action, the storeEventWithAck() 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 depending 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 storeEventWithAck action.
If you want to avoid the overhead of receiving acknowledgments each time event data is added to a database table, use the storeEvent action. If your application needs to handle a failure during a call to the storeEvent action, it should call the setStoreErrorCallback action; for more information, see Handling data storing errors.