Emit
Select and filter output events for publishing
Overview
Publish event query projections to downstream systems, with options to select, refine and calculate event attributes and filter the final projected event.
The following function can be applied to the projection expression
Event attribute selection Select event attributes to be included in the final results.
Add metric data Apply calculated metrics within the projection.
Apply simple math functions Use simple math function on the selected attributes.
Filter resulting projected data Use the having filter to narrow the result set, similar to the SQL having clause.
Attribute renaming using an alias Rename attributes to ease system integrations.
Using the select expression
To bring this to life, we shall use the following select query and final stream event that will be queried.
Query
Source event
The following event example will be used to demonstrate the select
query and having
filter.
Output event
This will produce the following result which is published to the connected consumers.
Using metrics
A key feature is the ability to use and embed calculated metrics within the select
expression.
This enables the following advanced capabilities:
Ability to add pre-calculated metrics within the select projection.
Perform calculations using event attributes and metrics.
Embed metrics values to be applied to within the
having
clause logic
For further information on how this feature is used go to the apply metrics documentation.
Example
Attributes schema
Format | Result | Description |
---|---|---|
BidMovingAverage.avg_ask;where symbol = {symbol} | 101.34 | Query the |
BidMovingAverage.avg_ask|avg_bid;where symbol = {symbol} | 101.34, 100.12 | Query the |
BidMovingAverage.avg_ask;where symbol = {symbol} AND venue=${venue.name} | 101.24, 100.22 | Query the |
having clause
This is a Javascript expression based filter that evaluates the expression against the resulting select projection result.
If the expression condition is met the resulting event is published otherwise it is dropped.
This is an optional property
Attributes schema
Attribute | Description | Data Type | Required |
---|---|---|---|
event type | Allows renaming of the event type in the published output. The default appends the final event type attribute to "_view" | String Default: <eventType>_view | |
select | SQL-style command that lets users specify which fields to include. Users can perform calculations (i.e., averages) on fields as well and it supports integration with the metrics engine for advanced calculations. Users can add metrics to the event output by specifying metric expressions in the select clause | String | |
having | This is a Javascript expression filter that evaluates the expression against the resulting select project. If the expression passes the resulting event is presented to publishing sinks | String |
Last updated