The SampleActor
(sample actor) is a Coral Actor that only emits a fraction of the supplied JSON trigger messages. The fraction can be specified by the user. The selection of messages to pass is random, but such that on average in the long term the fraction passed corresponds to the specified fraction.
The creation JSON of the sample actor (see Coral Actor) has type: "sample"
.
The params
value is a JSON with one field of two options:
field | type | description | |
---|---|---|---|
fraction |
float | optional | the fraction of messages to be passed |
percentage |
float | optional | the fraction of messages to be passed expressed as percentage number |
One and only one of these parameters has to be specified for correct definition. The percentage simply is 100 times the fraction.
{
"data": {
"type": "actors",
"attributes": {
"type": "sample",
"params": { "percentage": 12.5 }
}
}
}
This will create a sample actor that passes 12.5% of all messages.
The SampleActor
only does useful work if the trigger is connected.
The actor does not process the supplied JSON.
The SampleActor
emits the received JSON with probability equal to the supplied fraction.
Otherwise nothing is emitted.
The SampleActor
doesn’t keep state.
The SampleActor
does not collect state from other actors.
The SampleActor
does not provide timer actions.