Chapter 7 Working With the Query Language : Using Data from a Callback Rule Function

Using Data from a Callback Rule Function
When you use the Query.Statement.executeWithCallback() function, the agent calls the specified callback rule function once for each row of data generated. The row of data is provided as an array of columns.
The callback rule function is called in the following circumstances:
Once, when there are no more results, indicating the end of the results (snapshot queries) or that the statement was closed or the query deleted (continuous queries). See Closing a Statement and Deleting a Query Definition.
You can provide a closure object when executing the statement. The closure object is provided to each rule function call. It can contain anything useful in the execution context. For example, you can use an object array to accumulate each row of results returned in each callback rule function call.
The Callback Rule Function Required Signature
The callback function must have a signature with the following parameter types, provided in the order specified:
Identifies the current execution. Uses the value of ExecutionName, which was provided when calling the Query.Statement.executeWithCallback() function. The ID enables you to identify rows of data belonging to different executions of the same query (or different queries).
boolean isBatchEnd
Used in the case of continuous queries only, and is useful only when the query text contains an order by clause (see Order by Clause).
boolean hasEnded
An array of columns representing one row of data generated by the query. Each column corresponds to an item in the projection (see Select Clause).
Object closure
Closure object provided when executing the executing the Query.Statement.executeWithCallback() function, or null.
The object provided depends on your needs. For example, it could be a simple string, or it could be an array of objects used to add a row of data from each callback rule function.