Generating Data
A generator builds documents from a registered schema and emits them at a fixed rate, with nothing external attached. It exists so a pipeline can be run end to end — source, transform, sink, live metrics — before any source system is connected.
That matters most at the start. Connecting a real source usually means a MongoDB replica set with change streams enabled and a collection that already has traffic in it, or a broker with a topic somebody is publishing to. A generator replaces all of that with a schema.
What you still need
A generator removes the need for a source system, not for every system. 3TL Bridge already requires a MongoDB for its own configuration, so a first pipeline can generate documents and write them into a scratch collection there without connecting anything new.
Configuring a Generator
Rate, volume and seed describe the generator itself, so they live on the service rather than on any pipeline that uses it. A pipeline that wants a different rate names a different generator service.
| Field | Meaning |
|---|---|
| Events per second | The rate documents are emitted at. Paced, not bursts — if a sink falls behind, the stream slows rather than queueing a catch-up burst. |
| Total events | Stop after this many. Omit to run until the pipeline is stopped. |
| Seed | Fixes the sequence, so a run can be repeated exactly. Omit for a different stream each run. |
Two of these behave in ways worth knowing before you rely on them.
A total is per pipeline, not shared. Two pipelines using the same generator service each emit that many — a total of 25 across two pipelines produces 25 documents in each sink, not 25 split between them. The setting describes what the generator produces for whoever asks, not a pool to be divided.
A shared seed means identical documents. Two pipelines on the same generator service and the same schema emit the same sequence, document for document. That is the point of a seed — a run can be replayed — but it also means two pipelines you intended to be independent will not be.
A pipeline whose source is a generator finishes when the total is reached. With no total there is nothing to reach, so it runs until stopped.
The Schema Is the Contract
A generator will not start without one:
generator source 'demo-gen' requires a schema: set schema_id on the source
stage so the generator knows what to produce
This is a configuration error rather than an empty stream, because a generator with no schema has nothing to produce and would otherwise fail quietly. Both JSON Schema and Avro work — Avro is converted.
The schema defines the shape of every generated document, so it is also what makes generated data useful for testing a transform: the documents satisfy the schema they came from, and a pipeline that validates against that schema will pass.
Field-level rules can narrow what is produced — a range for a number, a fixed set of values for a string — without editing the registered schema itself.
Use Cases
- A first pipeline. See data move through source, transform and sink before connecting anything, and confirm the deployment works end to end.
- Demonstrations. A pipeline that runs anywhere, with no dependency on a database being reachable or a topic having traffic.
- Load and soak runs. A known, repeatable rate through the engine, which is what makes throughput numbers comparable between runs.
- Developing a transform before the data exists. Write and test transformation logic against documents matching the schema you have agreed, while the system that will eventually produce them is still being built.
Generating data from real records
A generator invents documents from a schema. To walk records that already exist — to seed a sink or re-process a range — use a scanner instead.