SampleActor

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.

Creating a SampleActor

The SampleActor has type: "sample". The params value is a JSON with two optional fields:

field type required description
fraction float yes the fraction of messages to be passed (range 0 to 1).


Example

{
  "data": {
    "type": "actors",
    "attributes": {
      "type": "sample",
        "params": { 
          "fraction": 0.125
      }
    }
  }
}


This will create a sample actor that passes 12.5% of all messages.

Trigger

The SampleActor only does useful work if the trigger is connected. The actor does nothing with the supplied JSON but just passes it through (or not).

Emit

The SampleActor emits the received JSON with probability equal to the supplied fraction.

State

The SampleActor does not keep state.

Collect

The SampleActor does not collect state from other actors.

Timer

The SampleActor does not provide timer actions.