Skip to content

Commit 5a93929

Browse files
committed
add instructions to update durableClient binding
1 parent 8dde0a7 commit 5a93929

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

articles/azure-functions/durable/durable-functions-node-model-upgrade.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,123 @@ In the v4 model, registering extra inputs has been moved from `function.json` fi
376376
# [v4 model](#tab/v4)
377377
378378
```javascript
379+
const { app } = require('@azure/functions');
380+
const df = require('durable-functions');
379381
382+
app.http('durableHttpStart', {
383+
route: 'orchestrators/{orchestratorName}',
384+
extraInputs: [df.input.durableClient()],
385+
handler: async (_request, context) => {
386+
const client = df.getClient(context);
387+
// Use client in function body
388+
},
389+
});
380390
```
381391
382392
# [v3 model](#tab/v3)
383393
394+
```javascript
395+
const df = require("durable-functions");
396+
397+
module.exports = async function (context, req) {
398+
const client = df.getClient(context);
399+
// Use client in function body
400+
};
401+
```
402+
403+
```json
404+
{
405+
"bindings": [
406+
{
407+
"authLevel": "anonymous",
408+
"name": "req",
409+
"type": "httpTrigger",
410+
"direction": "in",
411+
"route": "orchestrators/{functionName}",
412+
"methods": [
413+
"post",
414+
"get"
415+
]
416+
},
417+
{
418+
"name": "$return",
419+
"type": "http",
420+
"direction": "out"
421+
},
422+
{
423+
"name": "starter",
424+
"type": "durableClient",
425+
"direction": "in"
426+
}
427+
]
428+
}
429+
```
430+
384431
---
385432
:::zone-end
386433
387434
:::zone pivot="programming-language-typescript"
388435
436+
# [v4 model](#tab/v4)
437+
438+
```typescript
439+
import { app, HttpHandler, HttpRequest, HttpResponse, InvocationContext } from '@azure/functions';
440+
import * as df from 'durable-functions';
441+
442+
const durableHttpStart: HttpHandler = async (request: HttpRequest, context: InvocationContext): Promise<HttpResponse> => {
443+
const client = df.getClient(context);
444+
// Use client in function body
445+
};
446+
447+
app.http('durableHttpStart', {
448+
route: 'orchestrators/{orchestratorName}',
449+
extraInputs: [df.input.durableClient()],
450+
handler: durableHttpStart,
451+
});
452+
```
453+
454+
# [v3 model](#tab/v3)
455+
456+
```typescript
457+
import * as df from "durable-functions"
458+
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
459+
460+
const durableHttpStart: AzureFunction = async function (context: Context): Promise<any> {
461+
const client = df.getClient(context);
462+
// Use client in function body
463+
};
464+
465+
export default durableHttpStart;
466+
```
467+
468+
```json
469+
{
470+
"bindings": [
471+
{
472+
"authLevel": "anonymous",
473+
"name": "req",
474+
"type": "httpTrigger",
475+
"direction": "in",
476+
"route": "orchestrators/{functionName}",
477+
"methods": [
478+
"post",
479+
"get"
480+
]
481+
},
482+
{
483+
"name": "$return",
484+
"type": "http",
485+
"direction": "out"
486+
},
487+
{
488+
"name": "starter",
489+
"type": "durableClient",
490+
"direction": "in"
491+
}
492+
],
493+
"scriptFile": "../dist/durableHttpStart/index.js"
494+
}
495+
```
496+
497+
---
389498
:::zone-end

0 commit comments

Comments
 (0)