Map and Reduce

ESP queries can be used to implement a kind of "map and reduce" data processing pattern.

A message arrives at a destination that transforms it into an event of a certain type.

A query configured to listen for events of that type (as specified in the query’s from clause) then executes:

In the callback rule function for the following query, you would perform some kind of mapping operation. You would create event instances and then assert them using the following function:

Query.Statement.assertEvent("myStatement", myEvent);

The function sends the named event directly to all query instances registered under the given statement name. You can use the function one or more times in the callback rule function, according to your needs.

The callback rule function for each of the second-level queries could perform some kind of "reduce" operation, and then create and assert an event locally using the function Event.assertEvent(e). The event is piped to any query that is listening for it.

The callback rule function for the final level of query would create and send out an event containing the reduced, higher-value information, for example to a TIBCO BusinessEvents application.