Skip to content

Data sampler ​

Generates test data: for every message on Input it creates a new record of the output connection's type and fills its properties with (optionally seeded) random values. Use it to exercise a flow without a real data source, for example Timer → Data sampler → the flow under test.

Pins ​

PinKindTypesDescription
InputinputanyTrigger. Each message produces one sample; the payload is ignored.
Outputoutputthe type of the outgoing connectionA new record of that type filled with random values. Set the type on the outgoing connection; it decides what is generated.

Configuration ​

FieldTypeDefaultDescription
SeedstringSeed text. The same seed and the same (sequential) input sequence produce the same data. Empty = different data every run.
NullProbabilityinteger (0-100)10Percent chance that a nullable property (reference types such as string, and Nullable<T>) is set to null. Properties marked required in the type are never null.
NumberMinnumber0Lower bound for numeric properties.
NumberMaxnumber10000Upper bound for numeric properties.
CollectionMinItemsinteger (0-10000)0Minimum number of items in generated lists, arrays and dictionaries.
CollectionMaxItemsinteger (0-10000)5Maximum number of items in generated lists, arrays and dictionaries.

Behaviour ​

  • On start the generator for the output type is built once. If the output pin has no connection/type, nothing is generated and input messages are ignored.
  • Generated values:
    • string: 8-32 random letters and digits; char: one letter or digit; bool: random.
    • numbers (byte ... ulong, float, double, decimal): between NumberMin and NumberMax, clamped to the range of the property type.
    • DateTime, DateTimeOffset (UTC), DateOnly: between 1970-01-01 and 2100-01-01; TimeOnly, TimeSpan: within one day.
    • Guid (version 4), IPAddress (IPv4), enums (one of the defined values), byte[].
    • lists, arrays and dictionaries (string or value-type keys) with CollectionMinItems-CollectionMaxItems items; duplicate dictionary keys are dropped.
    • nested complex types are filled recursively up to 4 levels deep; deeper levels are null. The root record is never null.
  • Constraints declared on flow type properties are respected: minimum / maximum length for strings and byte[], minimum / maximum value for numbers (the declared range wins over NumberMin / NumberMax if they do not overlap). Regex validators are not honoured (a warning is shown).
  • Unsupported property types (object, interfaces, abstract classes, streams, types without a parameterless constructor) are left at their default value with a warning. Read-only and system properties are skipped.
  • The metadata of the input message is passed through to the output.

Notes ​

  • NumberMin must not be greater than NumberMax, CollectionMinItems not greater than CollectionMaxItems; otherwise the configuration is rejected. A numeric range that contains no valid value for a property type (for example NumberMax = -1 for a byte property) makes the flow fail to start.
  • Reproducibility with Seed holds only for sequential input; parallel callers (Fork, parallel ForEach) interleave the random sequence.

Example ​

json
{ "Seed": "test-1", "NullProbability": 0, "NumberMin": 1, "NumberMax": 100, "CollectionMinItems": 1, "CollectionMaxItems": 3 }

Timer → Data sampler (output connection type MyFlow.Order) → Data mapper → ...

Viaducta documentation