Building a Solution with Stream Analytics and IoT Hub - Exam AZ-220

Stream Analytics Job Parameters - Script1

Question

You are building a solution with several pressure sensors connected to an edge device.

Because of the large amount of incoming data, you decide to deploy a Stream Analytics job to the edge device, which can also reset the sensor device in case of errors.

Telemetry data from PressureSensor must be sent to IoT Hub and to the Stream Analytics job.

The alert messages must go to the IoT Hub and to the PressureSensor module to force a reset command on the device.

# deployment manifest { "modulesContent": { "$edgeAgent": { ..

}, "$edgeHub": { "properties.desired": { "schemaVersion": "1.1", "routes": { "telemetryToCloud": { "route": "<.............Script1.................>", "priority": 0, "timeToLiveSecs": 100 }, "telemetryToAsa": { "route": "FROM <source> WHERE <condition> INTO <sink>", "priority": 0, "timeToLiveSecs": 100 } }, "alertsToReset": { "route": "FROM <source> WHERE <condition> INTO <sink>", "priority": 0, } }, "alertsToCloud": { "route": "FROM <source> WHERE <condition> INTO <sink>", "priority": 0, } }, "storeAndForwardConfiguration": { "timeToLiveSecs": 10 } } }, "module1": { ..

}, "module2": { ..

} } }

Which of the following parameters goes to Script1?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: A

Diagram:

Azure Cloud

‘Azure Stream Azure
BR bnalytics Storage

Stage

a loT Edge device Deploy Insights

Option A is CORRECT because this route defines the path for sending sensor telemetry data to the $upstream, which is the IoT Hub, actually.

Option B is incorrect because it defines the path for sending pre-processed data from the Stream Analytics module to the cloud.

Option C is incorrect because this route can be used to send messages from the Stream Analytics job back to the PressureSensor.

Option D is incorrect because there is no $downstream parameter (you should use /messages/modules/{moduleName}), hence the statement is invalid.

References:

In the given deployment manifest for an Azure IoT Edge device, there are four routes defined for routing messages between different modules and endpoints. The first route, "telemetryToCloud," is used to send telemetry data from the PressureSensor module to IoT Hub. The second route, "telemetryToAsa," is used to send telemetry data from the PressureSensor module to a Stream Analytics job running on the same Edge device. The third route, "alertsToReset," is used to send alert messages to both IoT Hub and the PressureSensor module for resetting the device. The fourth route, "alertsToCloud," is used to send alert messages to IoT Hub.

The question is asking which parameter should be used in the "telemetryToCloud" route's Script1 to send telemetry data from the PressureSensor module to IoT Hub.

The options are:

A. FROM /messages/modules/PressureSensor/* INTO $upstream B. FROM /messages/modules/{myAsaModule}/* INTO $upstream C. FROM /messages/modules/{myAsaModule}/* INTO BrokeredEndpoint("/modules/PressureSensor/inputs/control") D. FROM $downstream INTO /messages/modules/PressureSensor/*

Option A is incorrect because it routes messages upstream, which is not required for sending data to IoT Hub.

Option B is incorrect because it routes messages from a different module ({myAsaModule}), not the PressureSensor module.

Option C is incorrect because it routes messages to a module input endpoint ("/modules/PressureSensor/inputs/control"), which is not required for sending data to IoT Hub.

Option D is also incorrect because it routes messages downstream, which is not required for sending data to IoT Hub.

Therefore, the correct answer is none of the above. There is no parameter provided in the options that can be used in Script1 to send telemetry data from the PressureSensor module to IoT Hub.

To achieve this, the following route can be added to the deployment manifest:

"telemetryToCloud": { "route": "FROM /messages/modules/PressureSensor/outputs/* INTO $upstream", "priority": 0, "timeToLiveSecs": 100 }

This route will route messages from the PressureSensor module's output endpoint ("/messages/modules/PressureSensor/outputs/*") to the upstream endpoint ($upstream), which will send them to IoT Hub. The Script1 parameter in the "telemetryToCloud" route should be set to this route.