The ThresholdActor
(threshold actor) is a Coral Actor that emits the received JSON when for the specified field the associated value is at least the specified threshold.
The creation JSON of the threshold actor (see Coral Actor) has type: "threshold"
.
The params
value is a JSON with two fields:
field | type | description | |
---|---|---|---|
key |
string | required | the name of the threshold field in the trigger-JSON |
threshold |
number | required | the value in the trigger-JSON for the threshold field should be at least this value to emit |
{
"data": {
"type": "actors",
"attributes": {
"type": "threshold",
"params": {
"key": "amount",
"threshold": 100
}
}
}
}
This will create a threshold actor for the field amount with threshold 100.
The ThresholdActor
only does useful work if the trigger is connected.
The actor gathers values supplied by the field specified in the parameters.
The ThresholdActor
emits the received JSON with the addition of the thresholdReached field with as value the specified field when the value is at least the threshold. Otherwise, nothing is emitted.
The ThresholdActor
doesn’t keep state.
The ThresholdActor
does not collect state from other actors.
The ThresholdActor
does not provide timer actions.