Skip to content

Commit ec25ab1

Browse files
Merge pull request #312933 from hhunter-ms/hh-374692
[Durable][UUF] Add typescript examples
2 parents 323f2cf + bb7d89b commit ec25ab1

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

articles/azure-functions/durable/durable-functions-diagnostics.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,32 @@ module.exports = df.orchestrator(function*(context){
240240
});
241241
```
242242

243+
<br>
244+
<details>
245+
<summary><b>Node.js programming model v4 apps (including TypeScript)</b></summary>
246+
247+
Use the same replay check pattern in your orchestration function:
248+
249+
```typescript
250+
import * as df from "durable-functions";
251+
252+
df.app.orchestration("FunctionChain", function* (context) {
253+
if (!context.df.isReplaying) context.log("Calling F1.");
254+
yield context.df.callActivity("F1");
255+
if (!context.df.isReplaying) context.log("Calling F2.");
256+
yield context.df.callActivity("F2");
257+
if (!context.df.isReplaying) context.log("Calling F3.");
258+
yield context.df.callActivity("F3");
259+
context.log("Done!");
260+
});
261+
```
262+
263+
> [!NOTE]
264+
> The `isReplaying` check suppresses duplicate logs caused by orchestrator replay. It doesn't suppress duplicate logs caused by full re-execution (for example, host restarts, long local debugging sessions, or queue message visibility timeouts). In those cases, you might still see repeated log lines with the same orchestration instance ID.
265+
266+
</details>
267+
<br>
268+
243269
# [Python](#tab/python)
244270

245271
```python
@@ -377,6 +403,25 @@ module.exports = df.orchestrator(function*(context){
377403
});
378404
```
379405

406+
<details>
407+
<summary><b>Node.js programming model v4 apps (including TypeScript)</b></summary>
408+
409+
```typescript
410+
import * as df from "durable-functions";
411+
412+
df.app.orchestration("FunctionChain", function* (context) {
413+
if (!context.df.isReplaying) context.log("Calling F1.");
414+
yield context.df.callActivity("F1");
415+
if (!context.df.isReplaying) context.log("Calling F2.");
416+
yield context.df.callActivity("F2");
417+
if (!context.df.isReplaying) context.log("Calling F3.");
418+
yield context.df.callActivity("F3");
419+
context.log("Done!");
420+
});
421+
```
422+
423+
</details>
424+
380425
# [Python](#tab/python)
381426

382427
```python
@@ -484,6 +529,25 @@ module.exports = df.orchestrator(function*(context) {
484529
});
485530
```
486531

532+
<details>
533+
<summary><b>Node.js programming model v4 apps (including TypeScript)</b></summary>
534+
535+
```typescript
536+
import * as df from "durable-functions";
537+
538+
df.app.orchestration("SetStatusTest", function* (context) {
539+
// ...do work...
540+
541+
// update the status of the orchestration with some arbitrary data
542+
const customStatus = { completionPercentage: 90.0, status: "Updating database records" };
543+
context.df.setCustomStatus(customStatus);
544+
545+
// ...do more work...
546+
});
547+
```
548+
549+
</details>
550+
487551
# [Python](#tab/python)
488552

489553
```python

0 commit comments

Comments
 (0)