CORAL WIKI

ThresholdActor

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.

Creating a ThresholdActor

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

Example

{
  "data": {
    "type": "actors",
    "attributes": {
      "type": "threshold",
      "params": {
        "key": "amount",
        "threshold": 100
      }
    }
  }
}

This will create a threshold actor for the field amount with threshold 100.

Trigger

The ThresholdActor only does useful work if the trigger is connected. The actor gathers values supplied by the field specified in the parameters.

Emit

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.

State

The ThresholdActor doesn’t keep state.

Collect

The ThresholdActor does not collect state from other actors.

Timer

The ThresholdActor does not provide timer actions.