Skip to main content

Schedule

loop

Commentary

added in 0.6.0

Loops a schedule, causing ShadowTraffic to generate data indefinitely.


Examples

Using loop

When the last stage of a schedule finishes, loop resets the schedule and begins execution from the first stage again.

{
"generators": [
{
"name": "a",
"topic": "generatorA",
"value": {
"_gen": "oneOf",
"choices": [
1,
2,
3
]
},
"localConfigs": {
"maxEvents": 3
}
},
{
"name": "b",
"topic": "generatorB",
"value": {
"_gen": "boolean"
},
"localConfigs": {
"maxEvents": 2
}
}
],
"schedule": {
"loop": true,
"stages": [
{
"generators": [
"a"
]
},
{
"generators": [
"b"
]
}
]
},
"connections": {
"kafka": {
"kind": "kafka",
"producerConfigs": {
"bootstrap.servers": "localhost:9092",
"key.serializer": "io.shadowtraffic.kafka.serdes.JsonSerializer",
"value.serializer": "io.shadowtraffic.kafka.serdes.JsonSerializer"
}
}
}
}
[
2,
3,
1,
false,
true,
2,
3,
1,
false,
false,
2,
1
]

Specification

JSON schema

{
"type": "boolean"
}