Adding an Event and a Rule to Populate the Metric Values

The onTicker rule is triggered whenever a new Ticker event is asserted. To populate the M_TickerTracker metric you add its ontology function compute() to the rule, and configure it.

Metrics are generally populated by a message arriving at a destination, which is transformed into an event. The event triggers a rule that computes the metric and tracking field values. The metric instance is created (or updated) using a special ontology function, compute().

Metrics have the following special-purpose ontology functions:

  • compute() - Checks if an instance of the metric already exists for the group by field values. If so, then the instance is updated. If not, a new instance is created. The function’s arguments map to the metric fields in top-down order, and then to tracking fields (if any), again in top-down order as you view the metric editor.
  • getMetricExtId() - Returns the extID for the metric, which can be used as a token for explicit locking. TIBCO BusinessEvents Views provides implicit locking by default. However depending on your needs, you can enable explicit locking. (See TIBCO BusinessEvents Architect’s Guide for more on locking).
  • lookup() - searches the cache or backing store for an instance of the metric based on the value of the the metric’s group by field or fields.
  • delete() - Deletes a metric instance in the cache (and backing store if one is used), based on the value of the metric’s group by field or fields. Also deletes all tracking table entries for the metric.

At runtime, the data source query assigned to a metric is triggered by changes or additions to metric instances. The query retrieves and filters data from the metric instance, and sends it to the Dashboard, for display in charts.

For more information, see TIBCO BusinessEvents Views Developer’s Guide.