Track Object Overview


A Track defines a realtime directional connection between a source Flow and one or more destination Flows. A Track's purpose is to monitor, filter, and/or transform the Drops from its source Flow to its destination(s) Flow. When a Drop enters a Flow, all Tracks that denote that Flow as a source are executed.

A Track can specify simple yet powerful filters in order to accept or reject Drops from the source Flow based on specified criteria. When a new Drop is written to the source a filter written in Flow Filter Language will test that Drop before doing any processing. If the Drop passes the filter, then an optional javascript transformation function is executed with the incoming Drop as the first parameter. If the function returns a valid set of Drop elements for one or more destinations, the Drop will be written to the destination Flow(s).

A Track can have a transformation function executed in a javascript environment which is augmented by much of the flow REST API; exposed in the form of the Flow.js utility library. Simple transformation functions take the input Drop as a json object and return the transformed Drop.

Using flow.js, you can also pull in Drops from other Flows to assist in the transform process and decision making.

  {
    "source": "/<account_id>/my_cool_project/incoming",
    "destination": ["/<account_id>/my_cool_project/high_priority"],
    "filter": "elems.error_rate > 0.1",
    "js": "function(in) {
      in.elems['needsAttention'] = true;
      return {
        '/<account_id>/my_cool_project/high_priority': [in]
      };
     }"
  }

Track Object Members


source

The source Flow path, Drops that are published into this Flow will be monitored by the Track. If no filter or js is applied to this Track, it will consume all Drops written to this Flow.

destination

A list of possible destination Flow paths, Drops that satisfy the Track's filter, and any conditions which may be present within the Track's js function, will be forwarded to these Flows.

filter

Filters are used to require that Drops processed by the Track have specific data elements and values. See Flow Filter Language for more information on using the Flow Filter Language.

js

A javascript function that takes a Drop matching the filter from the source Flow as its first argument and then returns a Drop to be written to the destination Flow(s). The API may be accessed from within the js in order to enhance Drops with data from other Flows by utilizing Flow.js.

Working with Tracks