...
Code Block |
---|
send-to-error-and-continue exp:{<condition>} [metric] ['message'] |
The condition
is a an EL specifying the condition that governs if the record should be sent to the error collector. Optionally, you can specify the metric name that should be registered every time a record is sent to error combined with optional ability to specify an error message that should be recorded.
...
The most common use of the SEND-TO-ERROR-AND-CONTINUE directive is to evaluate the data quality of the a record. This is a data cleansing directive to flag records that do not conform to specified rules.
The record is NOT sent to the error collector (if connected) when the condition for the record evaluates to true
. But, a an internal state is maintained of the checks that the record failfails.
Example
Assume a record that has these three fields:
...
Each invocation of send-to-error-and-continue
will increment a an internal transient variable dq_total
and dq_failure
variable when the condition evaluates to false
. Using the combination of transient variables, one you can determine if it's worth proceeding further with processing of record. This can be achieved using the send-to-error
to compute the percentage and set a threshold to emit the record as error.
...