Skip to content

Commit ba049f0

Browse files
committed
Fix Redis sample, adding Queue example.
Fixes #8
1 parent 8e8ea26 commit ba049f0

19 files changed

+148
-44
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"azureFunctions.projectLanguage": "C#",
3+
"azureFunctions.projectRuntime": "~2"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"azureFunctions.projectLanguage": "C#Script",
3+
"azureFunctions.projectRuntime": "~2"
4+
}

samples/EventGridSample/EventGridSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.23" />
7+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
88
</ItemGroup>
99
<ItemGroup>
1010
<ProjectReference Include="..\..\src\AzureFunctionExtensions\AzureFunctionExtensions.csproj" />
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"IsEncrypted": false,
33
"Values": {
4+
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
45
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
56
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
67
"AzureWebJobs_ExtensionsPath": ".",
7-
"eventgrid_sas": "EFgFqSaABprKP0Ww7jgf8TCY9L6lE3cVrB4+nVeloxc=",
8-
"eventgrid_endpoint": "https://frbtest.westeurope-1.eventgrid.azure.net/api/events"
8+
"eventgrid_sas": "",
9+
"eventgrid_endpoint": "https://xxxxx.westeurope-1.eventgrid.azure.net/api/events"
910
}
1011
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"ms-azuretools.vscode-azurefunctions",
4+
"ms-vscode.csharp"
5+
]
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Attach to C# Functions",
6+
"type": "coreclr",
7+
"request": "attach",
8+
"processId": "${command:azureFunctions.pickProcess}"
9+
}
10+
]
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"azureFunctions.projectRuntime": "~2",
3+
"azureFunctions.projectLanguage": "C#",
4+
"azureFunctions.templateFilter": "Verified",
5+
"azureFunctions.deploySubpath": "bin/Release/netstandard2.0/publish",
6+
"azureFunctions.preDeployTask": "publish",
7+
"debug.internalConsoleOptions": "neverOpen"
8+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "clean",
6+
"command": "dotnet clean",
7+
"type": "shell",
8+
"problemMatcher": "$msCompile"
9+
},
10+
{
11+
"label": "build",
12+
"command": "dotnet build",
13+
"type": "shell",
14+
"dependsOn": "clean",
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
},
19+
"problemMatcher": "$msCompile"
20+
},
21+
{
22+
"label": "clean release",
23+
"command": "dotnet clean --configuration Release",
24+
"type": "shell",
25+
"problemMatcher": "$msCompile"
26+
},
27+
{
28+
"label": "publish",
29+
"command": "dotnet publish --configuration Release",
30+
"type": "shell",
31+
"dependsOn": "clean release",
32+
"problemMatcher": "$msCompile"
33+
},
34+
{
35+
"label": "runFunctionsHost",
36+
"type": "shell",
37+
"dependsOn": "build",
38+
"options": {
39+
"cwd": "${workspaceFolder}/bin/Debug/netstandard2.0"
40+
},
41+
"command": "func host start",
42+
"isBackground": true,
43+
"problemMatcher": "$func-watch"
44+
}
45+
]
46+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Fbeltrao.AzureFunctionExtensions;
4+
using Microsoft.AspNetCore.Http;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.Azure.WebJobs;
7+
using Microsoft.Azure.WebJobs.Extensions.Http;
8+
using Microsoft.Azure.WebJobs.Host;
9+
using Microsoft.Extensions.Logging;
10+
using StackExchange.Redis;
11+
12+
namespace Fbeltrao.RedisSample
13+
{
14+
public static class QueueTriggerWithRedisFunctions
15+
{
16+
[FunctionName(nameof(MoveQueueItemToRedis))]
17+
public static async Task MoveQueueItemToRedis(
18+
[QueueTrigger("myqueue-items", Connection = "AzureWebJobsStorage")] string myQueueItem,
19+
[RedisDatabase(Connection = "%redis_connectionstring%")] IDatabase db,
20+
ILogger log)
21+
{
22+
await db.ListRightPushAsync("my-queue", myQueueItem);
23+
log.LogInformation($"Queue trigger pushed to redis list: {myQueueItem}");
24+
}
25+
26+
27+
[FunctionName(nameof(GetRedisList))]
28+
public static async Task<IActionResult> GetRedisList(
29+
[HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
30+
[RedisDatabase(Connection = "%redis_connectionstring%")] IDatabase db,
31+
ILogger log)
32+
{
33+
var values = await db.ListRangeAsync("my-queue");
34+
return new OkObjectResult(new { values });
35+
}
36+
}
37+
}

samples/RedisSample/RedisSample.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
</Content>
1010
</ItemGroup>
1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.23" />
12+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.2" />
13+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
1314
</ItemGroup>
1415
<ItemGroup>
1516
<ProjectReference Include="..\..\src\AzureFunctionExtensions\AzureFunctionExtensions.csproj" />

0 commit comments

Comments
 (0)