You are developing a telemetry processing workflow using Azure Durable Functions in Node.js. The orchestrator function must process incoming data, wait for 5 minutes, and then run an aggregation activity. You write the following orchestrator function code:
javascript
const df = require("durable-functions");
module.exports = df.orchestrator(function* (context) {
const input = context.df.getInput();
// Generate a unique identifier for the execution run
const runId = context.df.newGuid();
// Get the current date and time
const timestamp = new Date();
// Perform processing by calling an activity function
const processedData = yield context.df.callActivity("ProcessSensorData", input);
// Delay execution for 5 minutes
yield context.df.createTimer(new Date(Date.now() + 5 * 60 * 1000));
// Run the aggregation activity
yield context.df.callActivity("AggregateSensorData", { runId, timestamp, processedData });
});
During testing, you notice that the orchestrator behaves non-deterministically. Which two changes should you make to ensure the orchestrator complies with Durable Functions determinism constraints? Select two.
- Replace the instantiation of the local system date new Date() with context.df.currentUtcDateTime to capture the timestamp.Answer
- Calculate the timer deadline using context.df.currentUtcDateTime instead of Date.now().Answer
- CReplace context.df.newGuid() with the standard Node.js crypto.randomUUID() method to ensure unique tracking IDs.
- DReplace the activity calls with inline HTTP requests using a library like axios to execute the tasks directly within the orchestrator.