Skip to content

Commit 25d49d2

Browse files
committed
Updated durable-functions library to 1.1.4
1 parent e4579df commit 25d49d2

File tree

12 files changed

+201
-1072
lines changed

12 files changed

+201
-1072
lines changed

FanOutFanInCrawler/.vscode/launch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"type": "node",
77
"request": "attach",
88
"port": 5858,
9-
"protocol": "inspector",
109
"preLaunchTask": "runFunctionsHost"
1110
}
1211
]
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
2-
"azureFunctions.projectRuntime": "beta",
2+
"azureFunctions.projectRuntime": "~2",
33
"azureFunctions.projectLanguage": "JavaScript",
4-
"azureFunctions.templateFilter": "Verified"
4+
"azureFunctions.templateFilter": "Verified",
5+
"azureFunctions.deploySubpath": ".",
6+
"azureFunctions.preDeployTask": "installExtensions",
7+
"files.exclude": {
8+
"obj": true,
9+
"bin": true
10+
},
11+
"debug.internalConsoleOptions": "neverOpen"
512
}

FanOutFanInCrawler/.vscode/tasks.json

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,22 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Run Functions Host",
6-
"identifier": "runFunctionsHost",
5+
"label": "runFunctionsHost",
76
"type": "shell",
87
"command": "func host start",
8+
"isBackground": true,
9+
"problemMatcher": "$func-watch",
910
"options": {
1011
"env": {
11-
"languageWorkers:node:arguments": "--inspect=5858"
12+
"languageWorkers__node__arguments": "--inspect=5858"
1213
}
1314
},
14-
"isBackground": true,
15-
"presentation": {
16-
"reveal": "always"
17-
},
18-
"problemMatcher": [
19-
{
20-
"owner": "azureFunctions",
21-
"pattern": [
22-
{
23-
"regexp": "\\b\\B",
24-
"file": 1,
25-
"location": 2,
26-
"message": 3
27-
}
28-
],
29-
"background": {
30-
"activeOnStart": true,
31-
"beginsPattern": "^.*Stopping host.*",
32-
"endsPattern": "^.*Job host started.*"
33-
}
34-
}
35-
]
15+
"dependsOn": "installExtensions"
16+
},
17+
{
18+
"label": "installExtensions",
19+
"command": "func extensions install",
20+
"type": "shell"
3621
}
3722
]
3823
}

FanOutFanInCrawler/GetAllRepositoriesForOrganization/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ octokit.authenticate({
88
token: process.env['GitHubToken']
99
})
1010

11-
module.exports = async function(context, input) {
11+
module.exports = async function(context) {
1212
// retrieves the organization name from the Orchestrator function
13-
var organizationName = input
13+
var organizationName = context.bindings.input;
1414

1515
var finalResult = []
1616
let page = 1
@@ -25,5 +25,6 @@ module.exports = async function(context, input) {
2525
// merge the paged results inside a single array
2626
finalResult = finalResult.concat(result.data)
2727
} while (result.data.length !== 0)
28-
return finalResult
28+
29+
context.done(null, finalResult);
2930
}

FanOutFanInCrawler/GetOpenedIssues/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ octokit.authenticate({
99
token: process.env['GitHubToken']
1010
})
1111

12-
module.exports = async function(context, input) {
13-
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
14-
12+
module.exports = async function(context) {
13+
// `input` here is retrieved from the Orchestrator function `callActivity` input parameter
14+
var input = context.bindings.input;
15+
1516
let page = 1
1617
let issueCount = 0
1718

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
const df = require('durable-functions')
22

3-
module.exports = df.orchestrator(function*(context) {
3+
module.exports = df.orchestrator(function* (context) {
44
// retrieves the organization name from the Orchestrator_HttpStart function
5-
var organizationName = context.df.getInput()
5+
var organizationName = context.df.getInput();
6+
67
// retrieves the list of repositories for an organization by invoking a separate Activity Function.
7-
var repositories = yield context.df.callActivityAsync(
8-
'GetAllRepositoriesForOrganization',
9-
organizationName
10-
)
8+
var repositories = yield context.df.callActivity('GetAllRepositoriesForOrganization', organizationName);
119

1210
// Creates an array of task to store the result of each functions
1311
var output = []
1412
for (var i = 0; i < repositories.length; i++) {
1513
// Starting a `GetOpenedIssues` activity WITHOUT `yield`
1614
// This will starts Activity Functions in parallel instead of sequentially.
1715
output.push(
18-
context.df.callActivityAsync('GetOpenedIssues', repositories[i])
16+
context.df.callActivity('GetOpenedIssues', repositories[i])
1917
)
2018
}
2119

2220
// Wait for all Activity Functions to complete execution
2321
const results = yield context.df.Task.all(output)
2422

2523
// Send the list to an Activity Function to save them to Blob Storage.
26-
yield context.df.callActivityAsync('SaveRepositories', results)
24+
yield context.df.callActivity('SaveRepositories', results)
2725

2826
return context.instanceId
29-
})
27+
})

FanOutFanInCrawler/Orchestrator_HttpStart/function.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
{
1212
"type": "http",
1313
"direction": "out",
14-
"name": "res"
14+
"name": "$return"
1515
},
1616
{
1717
"name": "starter",
1818
"type": "orchestrationClient",
19-
"direction": "out"
19+
"direction": "in"
2020
}
2121
]
2222
}
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
const uuid = require('uuid/v4')
1+
const df = require("durable-functions");
2+
module.exports = async function(context) {
3+
4+
const client = df.getClient(context);
5+
const instanceId = await client.startNew('Orchestrator', undefined, 'Nuget');
26

3-
module.exports = function(context, req, starter) {
4-
var id = uuid()
7+
context.log(`Started orchestration with ID = '${instanceId}'.`);
58

6-
// Function input comes from the request content.
7-
context.bindings.starter = [
8-
{
9-
FunctionName: 'Orchestrator',
10-
Input: 'Nuget',
11-
InstanceId: id
12-
}
13-
]
14-
15-
context.done(null)
9+
return client.createCheckStatusResponse(context.bindingData.req, instanceId);
1610
}

FanOutFanInCrawler/SaveRepositories/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const df = require('durable-functions')
22
var storage = require('azure-storage')
33

4-
module.exports = async (context, input) => {
5-
// `input` here is retrieved from the Orchestrator function `callActivityAsync` input parameter
6-
4+
module.exports = async (context) => {
5+
// `input` here is retrieved from the Orchestrator function `callActivity` input parameter
6+
var input = context.bindings.input;
7+
78
// create the table service for Blob Storage
89
var tableService = storage.createTableService(
910
process.env['AzureWebJobsStorage']

FanOutFanInCrawler/extensions.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<DefaultItemExcludes>**</DefaultItemExcludes>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.6.2" />
9-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0" />
10-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.1" />
8+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.7.1" />
9+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.1" />
10+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.2" />
1111
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.1" />
1212
</ItemGroup>
1313
</Project>

0 commit comments

Comments
 (0)