[ { "id": "ex04-tab", "type": "tab", "label": "Azure: 04 Input to output", "info": "Receive routed JSON on input1, annotate objects, and send on output2. Arrays and scalars retain their values." }, { "id": "ex04-intro", "type": "comment", "z": "ex04-tab", "name": "Start here: input1 + output2 routes", "info": "Requires Edge workload identity and a single shared Module Client. Reuse an existing config/remove duplicates when importing multiple examples. Merge the README sensorToNodeRed and forwardedToHub routes into edgeHub.properties.desired.routes, replacing sensor/nodeRed with actual deployment module IDs. The sensor module must emit JSON on output1. Inspect the received body, then verify upstream output2: object payloads gain forwardedAt; arrays/scalars retain their values. The Function re-encodes literal strings as JSON text because Module Output parses string payloads as JSON. Complete is SDK send completion, not downstream processing. Review Debug output before production use.", "x": 320, "y": 60, "wires": [] }, { "id": "ex04-client", "type": "moduleclient" }, { "id": "ex04-input", "type": "moduleinput", "z": "ex04-tab", "client": "ex04-client", "input": "input1", "x": 170, "y": 160, "wires": [["ex04-prepare", "ex04-input-debug"]] }, { "id": "ex04-prepare", "type": "function", "z": "ex04-tab", "name": "Prepare output payload", "func": "const payload = msg.payload;\nif (payload !== null && typeof payload === 'object' && !Array.isArray(payload)) {\n msg.payload = { ...payload, forwardedAt: new Date().toISOString() };\n} else if (typeof payload === 'string') {\n // Module Output expects JSON text for strings, not raw text.\n msg.payload = JSON.stringify(payload);\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 440, "y": 160, "wires": [["ex04-output"]] }, { "id": "ex04-output", "type": "moduleoutput", "z": "ex04-tab", "client": "ex04-client", "output": "output2", "x": 730, "y": 160, "wires": [] }, { "id": "ex04-input-debug", "type": "debug", "z": "ex04-tab", "name": "Received JSON (topic: input)", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 460, "y": 220, "wires": [] }, { "id": "ex04-catch", "type": "catch", "z": "ex04-tab", "name": "Input/transform/output errors", "scope": ["ex04-input", "ex04-prepare", "ex04-output"], "uncaught": false, "x": 220, "y": 320, "wires": [["ex04-error-debug"]] }, { "id": "ex04-error-debug", "type": "debug", "z": "ex04-tab", "name": "Inspect msg.error", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 530, "y": 320, "wires": [] }, { "id": "ex04-complete", "type": "complete", "z": "ex04-tab", "name": "Forward send completed", "scope": ["ex04-output"], "uncaught": false, "x": 210, "y": 380, "wires": [["ex04-complete-debug"]] }, { "id": "ex04-complete-debug", "type": "debug", "z": "ex04-tab", "name": "Forward SDK completion", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "x": 550, "y": 380, "wires": [] }, { "id": "ex04-status", "type": "status", "z": "ex04-tab", "name": "Input/output status", "scope": ["ex04-input", "ex04-output"], "x": 200, "y": 440, "wires": [["ex04-status-debug"]] }, { "id": "ex04-status-debug", "type": "debug", "z": "ex04-tab", "name": "Connection/activity status", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "status", "x": 550, "y": 440, "wires": [] } ]