Fork
oneTimeKeys
Commentary
added in 0.7.10
By default, when a forked generator terminates, a new fork will respawn in its place. But when oneTimeKeys
is set to true
, no new generator will respawn in its place.
This desirable for use cases like abandoned shopping carts. If you have a forked generator that represents a shopping cart, you never want activity for an abandoned cart to resume.
Take care when using this parameter not to spawn an infinite number of forks. ShadowTraffic will track all previously used fork keys, and if you continue to spawn new ones, it will eventually run out of memory.
Examples
Using a key only once
When oneTimeKeys
is set to true
, the child
topic will only ever receive 3 events: one for each id
generated in the parent.
[
{
"topic": "parent",
"value": {
"_gen": "sequentialString",
"expr": "id-~d"
},
"localConfigs": {
"maxEvents": 3
}
},
{
"topic": "child",
"fork": {
"key": {
"_gen": "lookup",
"topic": "parent",
"path": [
"value"
]
},
"oneTimeKeys": true
},
"value": {
"_gen": "var",
"var": "forkKey"
},
"localConfigs": {
"maxEvents": 1
}
}
]
Specification
JSON schema
{
"type": "boolean"
}