Simulator
The simulator is the fastest way to get data flowing - realistic sample events, no real backend. Use it to build and test a surface or warm query before a real source is ready.
Add one
Drag a Simulator onto the canvas (or ask Thinky: "add a simulator for signups") and wire it to a connection. Open the Inspector to configure it.
Configure
| Setting | What it does |
|---|---|
| Name | A label for the simulator |
| Message Interval (ms) | Time between messages - default 30000, minimum 15000 |
| Messages per device | Total to send; 0 = keep going |
| Variables | Values your template can reference (e.g. random ranges) |
| Message template | The shape of each event (JSON) |
The template names each value with a $.Name placeholder, and each name is defined in Variables - for
example a random value in a range. Numbers go unquoted:
{ "signups": $.Signups, "activeUsers": $.ActiveUsers }
with these Variables (the Variables tab shows them as the form described below; this JSON is the value that is stored, and what Thinky sets):
[
{ "name": "Signups", "random": true, "min": 0, "max": 50 },
{ "name": "ActiveUsers", "random": true, "min": 100, "max": 500 }
]
{{...}} placeholders are not supported: they come through as literal text. $.DeviceId, $.Guid, $.Time,
$.LocalTime, $.Ticks, $.Epoch and $.MachineName are built in, so you can use them without a Variables
entry; they appear in an event only if your template includes them. Nothing is added for you: the device id and
the time are in an event only when the template asks for them.
Variable types
In the Variables tab, + Add Variable adds one. Each has a Name and a Type:
| Type | What it makes | Fields |
|---|---|---|
| Counter (min..max, step) | A number that moves from the minimum toward the maximum by the step each message | Min, Max, Step |
| Random Integer (min..max) | A random whole number in the range | Min, Max |
| Random Double (min..max) | A random decimal in the range | Min, Max |
| List (Random) | One of your values, picked at random | Values |
| List (Sequence) | Your values in order, one per message | Values |
| Random String (length) | A random string | Length (bytes) |
There is no fixed-value type; a List with one value does that job. A new variable starts as a Random Integer from 0 to 100.
The Template tab
The Template tab builds the message field by field, so you do not write the JSON by hand. + Add Field adds a Key, a Type (String, Number, Boolean, Null, Variable or Object) and a Value. Choose Variable to put one of your variables, or a built-in, in that field. A variable that makes numbers is written without quotes and one that makes text is written with them, so the message stays valid.
Start it
Draw a line from the simulator to the connection it should feed; the line is labelled "simulates".
Accepting or saving a simulator writes it to the workspace; it does not start it. Press Deploy to build and start it in your cloud.
A simulator keeps running until you switch it off, or until it has sent its Messages per Device (when that is
not 0). Switch it off in its Inspector header and press Deploy to stop it; press Start, then Deploy,
to run it again. An idle simulator is not stopped for you: OpenX has a scheduled job that stops one nobody has
touched for a long time, but it can only act in a workspace that has enrolled its service account as a member,
and OpenX enrols that account nowhere today. A simulator that keeps crashing is not stopped either.
Verify
Watch the Live Stream panel for incoming events (an AI can confirm the connection is healthy
with get_stats). With the template above, each event carries values like:
{
"signups": 12,
"activeUsers": 318
}
The first event arrives after the first interval (30 seconds by default), once the Deploy has finished starting the simulator. It is not instant.
When it does not work
| What you see | What to check |
|---|---|
| No data | The line from the simulator to the connection is drawn, the simulator is switched on, and Deploy has finished |
| Data stopped | Check Messages per Device: a value above 0 ends the sending once it is reached. Check the simulator is still switched on, then Deploy |
| The wrong data shape | Fix the Variables and Template tabs, then Deploy again; a change is not live until it is deployed |
| Too much data | Raise the Message Interval (ms), or switch the simulator off and Deploy |
| An interval is refused | The floor is 15000 ms. The field warns "Minimum interval is 15000 ms." and a lower value is refused with "Message Interval must be at least 15000 ms." |
Good habits
- Test queries here first. Build warm queries against simulated data before a real source is ready.
- Match your real shapes. Give the template the field names your real devices will send, so the queries carry over.
- Switch it off when you are done. A running simulator keeps adding data. Switch it off and Deploy.
- Write down the variables. Keep the variable names and the template with the connection's notes for your team.
A simulator you write yourself
For a scenario the built-in simulator does not cover (replaying history, a state machine, a failure test), write a device that connects the way a real one does, with the connection's own credentials from Live Devices: open the connection's Connection Info tab and copy Device ConnStr (primary). Any language with an Azure IoT device SDK works. A TypeScript example:
import { Client, Message } from 'azure-iot-device';
import { Mqtt } from 'azure-iot-device-mqtt';
const client = Client.fromConnectionString('YOUR_DEVICE_CONNECTION_STRING', Mqtt);
async function sendTelemetry() {
const message = {
deviceId: 'custom-sensor-001',
temperature: Math.random() * 10 + 65,
humidity: Math.random() * 20 + 40,
timestamp: new Date().toISOString(),
};
await client.sendEvent(new Message(JSON.stringify(message)));
}
setInterval(sendTelemetry, 30000);
The example is a sketch to adapt; it was not run against a workspace. The built-in simulator's 15 second floor is the simulator's own, so a device you write is not held to it, but every message is a message in your hub, so keep the rate to what you need.
Then
Route it to a Surface and crystallize a Warm Query. Switch to a real source (API Source or live device) when you're ready - the surface and queries stay the same.
On fathym.com: OpenX →