By expression

Use Javascript expressions to define custom filters

Objective

Enable developers the flexibility to define filtering logic using Javascript.

This is ideal when there is a need to fine tune the filtering process to the needs of the use case.

Uses

There are various uses for this filter such as:

  1. In software development Enable developers to create complex filtering logic by combining multiple conditions within a single filter process, simplifying the pipeline.

  2. In data science Use layered filters to refine datasets, allowing specific data points to pass through for targeted analysis.

  3. In cybersecurity Apply multi-layered filters to detect specific patterns or anomalies in real-time, improving threat detection accuracy.

Example & DSL attributes

This will provide all IBM events to the next processors.

Top level StreamEvent attributes are not available within the scripting processing context.

filter:
  expression: "(typeof symbol !== 'undefined' && symbol === 'IBM') ? true : false;"

Attributes schema

Attribute
Description
Data Type
Required

expression

A valid Javascript expression that returns a boolean value

String

Last updated