add c# examples with working templates

This commit is contained in:
Maran Palaniappan (from Dev Box) 2024-02-27 18:26:52 -08:00
Родитель b91330278e
Коммит d76af60cec
35 изменённых файлов: 645 добавлений и 4 удалений

Просмотреть файл

@ -41,7 +41,7 @@
<file src="..\..\..\Functions.Templates\Templates\KustoOutputBinding-CSharp-Isolated\**" target="content\KustoOutputBinding-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DurableFunctionsOrchestration-CSharp-Isolated\**" target="content\DurableFunctionsOrchestration-CSharp" />
<file src="..\..\..\Functions.Templates\Templates\SqlTrigger-CSharp-Isolated\**" target="content\SqlTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\RedisPubSubTrigger-CSharp-Isolated\**" target="content\RedisPubSubTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DaprServiceInvocationTrigger-CSharp-Isolated\**" target="content\DaprServiceInvocationTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprTopicTrigger-CSharp-Isolated\**" target="content\DaprTopicTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprPublishOutputBinding-CSharp-Isolated\**" target="content\DaprPublishOutputBinding-CSharp-Isolated" exclude="**\*.md" />

Просмотреть файл

@ -41,7 +41,7 @@
<file src="..\..\..\Functions.Templates\Templates\KustoOutputBinding-CSharp-Isolated\**" target="content\KustoOutputBinding-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DurableFunctionsOrchestration-CSharp-Isolated\**" target="content\DurableFunctionsOrchestration-CSharp" />
<file src="..\..\..\Functions.Templates\Templates\SqlTrigger-CSharp-Isolated\**" target="content\SqlTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\RedisPubSubTrigger-CSharp-Isolated\**" target="content\RedisPubSubTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DaprServiceInvocationTrigger-CSharp-Isolated\**" target="content\DaprServiceInvocationTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprTopicTrigger-CSharp-Isolated\**" target="content\DaprTopicTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprPublishOutputBinding-CSharp-Isolated\**" target="content\DaprPublishOutputBinding-CSharp-Isolated" exclude="**\*.md" />

Просмотреть файл

@ -40,7 +40,7 @@
<file src="..\..\..\Functions.Templates\Templates\KustoOutputBinding-CSharp-Isolated\**" target="content\KustoOutputBinding-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DurableFunctionsOrchestration-CSharp-Isolated\**" target="content\DurableFunctionsOrchestration-CSharp" />
<file src="..\..\..\Functions.Templates\Templates\SqlTrigger-CSharp-Isolated\**" target="content\SqlTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\RedisPubSubTrigger-CSharp-Isolated\**" target="content\RedisPubSubTrigger-CSharp-Isolated" />
<file src="..\..\..\Functions.Templates\Templates\DaprServiceInvocationTrigger-CSharp-Isolated\**" target="content\DaprServiceInvocationTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprTopicTrigger-CSharp-Isolated\**" target="content\DaprTopicTrigger-CSharp-Isolated" exclude="**\*.md" />
<file src="..\..\..\Functions.Templates\Templates\DaprPublishOutputBinding-CSharp-Isolated\**" target="content\DaprPublishOutputBinding-CSharp-Isolated" exclude="**\*.md" />

Просмотреть файл

@ -49,9 +49,9 @@
<file src="..\..\..\Functions.Templates\Templates\SqlTrigger-CSharp\**" target="content\SqlTrigger-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\KustoInputBinding-CSharp\**" target="content\KustoInputBinding-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\KustoOutputBinding-CSharp\**" target="content\KustoOutputBinding-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\DaprServiceInvocationTrigger-CSharp\**" target="content\DaprServiceInvocationTrigger-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\DaprTopicTrigger-CSharp\**" target="content\DaprTopicTrigger-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\DaprPublishOutputBinding-CSharp\**" target="content\DaprPublishOutputBinding-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
<file src="..\..\..\Functions.Templates\Templates\RedisPubSubTrigger-CSharp\**" target="content\RedisPubSubTrigger-CSharp" exclude="**\*.csx;**\*.md;**\*.dat;**\function.json;**\metadata.json" />
</files>
</package>

Просмотреть файл

@ -168,6 +168,9 @@
<file src="..\..\..\Functions.Templates\templates\KustoInputBinding-JavaScript\**" target="templates\KustoInputBinding-JavaScript" />
<file src="..\..\..\Functions.Templates\templates\KustoOutputBinding-JavaScript\**" target="templates\KustoOutputBinding-JavaScript" />
<file src="..\..\..\Functions.Templates\templates\RedisPubSubTrigger-CSharp\*.*" target="templates\RedisPubSubTrigger-CSharp" exclude="**\*.cs" />
<file src="..\..\..\Functions.Templates\templates\RedisPubSubTrigger-CSharp-Isolated\*.*" target="templates\RedisPubSubTrigger-CSharp-Isolated" exclude="**\*.cs" />
<!-- Templates v2 -->
<file src="../../../Functions.Templates\Bindings\userPrompts.json" target="Bindings-v2/userPrompts.json" />
<file src="..\..\..\Functions.Templates\Templates-v2\DaprPublishOutputBinding-Python\*.*" target="templates-v2\DaprPublishOutputBinding-Python"/>

Просмотреть файл

@ -2013,6 +2013,269 @@
"help": "[variables('appSettingsHelp')]"
}
]
},
{
"type": "redisPubSubTrigger",
"displayName": "$redisPubSubTrigger_displayName",
"direction": "trigger",
"enabledInTryMode": true,
"documentation": "$content=Documentation\\redisPubSubTrigger.md",
"extension": {
"id": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview"
},
"settings": [
{
"name": "name",
"value": "string",
"defaultValue": "changes",
"required": true,
"label": "$redisPubSubTrigger_name_label",
"help": "$redisPubSubTrigger_name_help",
"validators": [
{
"expression": "^[a-zA-Z][a-zA-Z0-9]{0,127}$",
"errorText": "[variables('parameterName')]"
}
]
},
{
"name": "connection",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redis_connection_label",
"help": "$redis_connection_help",
"placeholder": "[variables('selectConnection')]"
},
{
"name": "channel",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redisPubSubTrigger_channel_label",
"help": "$redisPubSubTrigger_channel_help"
},
{
"name": "pattern",
"value": "boolean",
"defaultValue": false,
"required": true,
"label": "$redisPubSubTrigger_pattern_label",
"help": "$redisPubSubTrigger_pattern_help"
}
]
},
{
"type": "redisListTrigger",
"displayName": "$redisListTrigger_displayName",
"direction": "trigger",
"enabledInTryMode": true,
"documentation": "$content=Documentation\\redisListTrigger.md",
"extension": {
"id": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview"
},
"settings": [
{
"name": "name",
"value": "string",
"defaultValue": "changes",
"required": true,
"label": "$redisListTrigger_name_label",
"help": "$redisListTrigger_name_help",
"validators": [
{
"expression": "^[a-zA-Z][a-zA-Z0-9]{0,127}$",
"errorText": "[variables('parameterName')]"
}
]
},
{
"name": "connection",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redis_connection_label",
"help": "$redis_connection_help",
"placeholder": "[variables('selectConnection')]"
},
{
"name": "key",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redisListTrigger_key_label",
"help": "$redisListTrigger_key_help"
},
{
"name": "pollingIntervalInMs",
"value": "long",
"defaultValue": 1000,
"required": true,
"label": "$redisTrigger_pollingIntervalInMs_label",
"help": "$redisTrigger_pollingIntervalInMs_help"
},
{
"name": "maxBatchSize",
"value": "int",
"defaultValue": 16,
"required": true,
"label": "$redisTrigger_maxBatchSize_label",
"help": "$redisTrigger_maxBatchSize_help"
},
{
"name": "listDirection",
"value": "string",
"defaultValue": "LEFT",
"required": true,
"label": "$redisListTrigger_listDirection_label",
"help": "$redisListTrigger_listDirection_help"
}
]
},
{
"type": "redisStreamTrigger",
"displayName": "$redisStreamTrigger_displayName",
"direction": "trigger",
"enabledInTryMode": true,
"documentation": "$content=Documentation\\redisStreamTrigger.md",
"extension": {
"id": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview"
},
"settings": [
{
"name": "name",
"value": "string",
"defaultValue": "changes",
"required": true,
"label": "$redisStreamTrigger_name_label",
"help": "$redisStreamTrigger_name_help",
"validators": [
{
"expression": "^[a-zA-Z][a-zA-Z0-9]{0,127}$",
"errorText": "[variables('parameterName')]"
}
]
},
{
"name": "connection",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redis_connection_label",
"help": "$redis_connection_help",
"placeholder": "[variables('selectConnection')]"
},
{
"name": "key",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redisStreamTrigger_key_label",
"help": "$redisStreamTrigger_key_help"
},
{
"name": "pollingIntervalInMs",
"value": "long",
"defaultValue": 1000,
"required": true,
"label": "$redisTrigger_pollingIntervalInMs_label",
"help": "$redisTrigger_pollingIntervalInMs_help"
},
{
"name": "maxBatchSize",
"value": "int",
"defaultValue": 16,
"required": true,
"label": "$redisTrigger_maxBatchSize_label",
"help": "$redisTrigger_maxBatchSize_help"
}
]
},
{
"type": "redis",
"displayName": "$redisIn_displayName",
"direction": "in",
"enabledInTryMode": true,
"documentation": "$content=Documentation\\redisIn.md",
"extension": {
"id": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview"
},
"settings": [
{
"name": "name",
"value": "string",
"defaultValue": "changes",
"required": true,
"label": "$redisIn_name_label",
"help": "$redisIn_name_help",
"validators": [
{
"expression": "^[a-zA-Z][a-zA-Z0-9]{0,127}$",
"errorText": "[variables('parameterName')]"
}
]
},
{
"name": "connection",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redis_connection_label",
"help": "$redis_connection_help",
"placeholder": "[variables('selectConnection')]"
},
{
"name": "command",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redisIn_command_label",
"help": "$redisIn_command_help"
}
]
},
{
"type": "redis",
"displayName": "$redisOut_displayName",
"direction": "in",
"enabledInTryMode": true,
"documentation": "$content=Documentation\\redisOut.md",
"extension": {
"id": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview"
},
"settings": [
{
"name": "name",
"value": "string",
"defaultValue": "changes",
"required": true,
"label": "$redisOut_name_label",
"help": "$redisOut_name_help",
"validators": [
{
"expression": "^[a-zA-Z][a-zA-Z0-9]{0,127}$",
"errorText": "[variables('parameterName')]"
}
]
},
{
"name": "connection",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redis_connection_label",
"help": "$redis_connection_help",
"placeholder": "[variables('selectConnection')]"
},
{
"name": "command",
"value": "string",
"defaultValue": "object",
"required": true,
"label": "$redisOut_command_label",
"help": "$redisOut_command_help"
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,26 @@
#### Settings for Redis Input Binding
See [Azure Functions Redis Extension](https://github.com/Azure/azure-functions-redis-extension) for general information about all Redis Bindings.
The settings for a `RedisInput` binding specifies the following properties:
- `type` : Must be set to *redis*.
- `name` : The name of the parameter that the returned value binds to.
- `direction` : Must be set to *in*.
- `connection` : The name of an app setting that contains the Redis connection information. See the [available connection types](https://github.com/Azure/azure-functions-redis-extension?tab=readme-ov-file#connection-types) for more information.
- `command` : The redis-cli command to be executed on the cache with all arguments separated by spaces. (e.g. `"GET key"`, `"HGET key field"`)
#### Redis Input Binding C# code example
This C# code gets any key that was recently set when keyspace notifications are enabled. Please refer to our [samples](https://github.com/Azure/azure-functions-redis-extension/tree/main/samples) for more examples.
```csharp
[FunctionName(nameof(SetGetter))]
public static void SetGetter(
[RedisPubSubTrigger("Redis", "__keyevent@0__:set")] ChannelMessage message,
[Redis("Redis", "GET {Message}")] string value,
ILogger logger)
{
logger.LogInformation($"Key '{message.Message}' was set to value '{value}'");
}
```

Просмотреть файл

@ -0,0 +1,27 @@
#### Settings for Redis Output Binding
See [Azure Functions Redis Extension](https://github.com/Azure/azure-functions-redis-extension) for general information about all Redis Bindings.
The settings for a `RedisOutput` binding specifies the following properties:
- `type` : Must be set to *redis*.
- `name` : The name of the parameter that the value binds to.
- `direction` : Must be set to *out*.
- `connection` : The name of an app setting that contains the Redis connection information. See the [available connection types](https://github.com/Azure/azure-functions-redis-extension?tab=readme-ov-file#connection-types) for more information.
- `command` : The Redis command to be executed on the cache without any arguments. (e.g. `"GET"`, `"HGET"`)
#### Redis Output Binding C# code example
This C# code deletes any key that was recently set when keyspace notifications are enabled. Please refer to our [samples](https://github.com/Azure/azure-functions-redis-extension/tree/main/samples) for more examples.
```csharp
[FunctionName(nameof(SetDeleter))]
public static void SetDeleter(
[RedisPubSubTrigger("Redis", "__keyevent@0__:set")] ChannelMessage message,
[Redis("Redis", "DEL")] out string arguments,
ILogger logger)
{
logger.LogInformation($"Deleting recently SET key '{message.Message}'");
arguments = message.Message;
}
```

Просмотреть файл

@ -0,0 +1,71 @@
{
"author": "Microsoft",
"classifications": [
"Azure Function",
"Trigger",
"Redis"
],
"name": "RedisPubSubTriggerCSharp",
"identity": "Azure.Function.CSharp.Isolated.RedisPubSubTriggerCSharp.3.x",
"groupIdentity": "Azure.Function.RedisPubSubTriggerCSharp",
"shortName": "rqueue",
"tags": {
"language": "C#",
"type": "item"
},
"sourceName": "RedisPubSubTriggerCSharp",
"symbols": {
"namespace": {
"description": "namespace for the generated code",
"replaces": "Company.Function",
"type": "parameter"
},
"connection": {
"description": "The name of the app setting containing your Redis connection string.",
"type": "parameter",
"defaultValue": "RedisConnectionString",
"replaces": "RedisConnectionString"
},
"channel": {
"description": "Redis pubsub channel that the trigger will listen to.",
"type": "parameter",
"defaultValue": "",
"replaces": "redisChannel"
}
},
"primaryOutputs": [
{
"path": "RedisPubSubTriggerCSharp.cs"
}
],
"defaultName": "RedisPubSubTriggerCSharp",
"postActions": [
{
"Description": "Adding Reference to Microsoft.Azure.Functions.Worker.Extensions.Redis Nuget package",
"ActionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
"ContinueOnError": "true",
"ManualInstructions": [],
"args": {
"referenceType": "package",
"reference": "Microsoft.Azure.Functions.Worker.Extensions.Redis", "version": "0.5.0-preview",
"projectFileExtensions": ".csproj"
}
},
{
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"description": "Opens the function class file in the editor",
"manualInstructions": [],
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
"args": {
"files": "0"
},
"continueOnError": true
}
]
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"name": {
"text": "Redis PubSub Trigger",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "3000"
},
"description": {
"text": "A C# function triggers based on messages from a Redis pubsub channel.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "3001"
},
"order": 1000,
"icon": "vs-2017.3/functionF.png",
"learnMoreLink": "https://github.com/Azure/azure-functions-redis-extension",
"uiFilters": [
"functions"
],
"symbolInfo": [
{
"id": "connection",
"name": {
"id": "4100",
"text": "The name of the app setting containing your Redis connection string",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
},
{
"id": "channel",
"name": {
"id": "4101",
"text": "Redis pubsub channel that the trigger will listen to.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
}
]
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 554 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1003 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 527 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 930 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 385 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 635 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 385 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 635 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 735 B

Просмотреть файл

@ -0,0 +1,30 @@
using Microsoft.Azure.Functions.Worker.Extensions.Redis;
using Microsoft.Extensions.Logging;
namespace Company.Function
{
public class RedisPubSubTriggerCSharp
{
private readonly ILogger<RedisPubSubTriggerCSharp> logger;
public RedisPubSubTriggerCSharp(ILogger<RedisPubSubTriggerCSharp> logger)
{
this.logger = logger;
}
[Function(nameof(RedisPubSubTriggerCSharp))]
public static void Run(
[RedisPubSubTrigger("RedisConnectionString", "redisChannel")] ChannelMessage message,
ILogger log)
{
log.LogInformation($"Message '{message.Message}' was pushed to channel '{message.Channel}'");
}
}
public class ChannelMessage
{
public string SubscriptionChannel { get; set; }
public string Channel { get; set; }
public string Message { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,71 @@
{
"author": "Microsoft",
"classifications": [
"Azure Function",
"Trigger",
"Redis"
],
"name": "RedisPubSubTrigger",
"identity": "Azure.Function.CSharp.RedisPubSubTrigger",
"groupIdentity": "Azure.Function.RedisPubSubTrigger",
"shortName": "redisPubSubTrigger",
"tags": {
"language": "C#",
"type": "item"
},
"sourceName": "RedisPubSubTriggerCSharp",
"symbols": {
"namespace": {
"description": "namespace for the generated code",
"replaces": "Company.Function",
"type": "parameter"
},
"connection": {
"description": "The name of the app setting containing your Redis connection string.",
"type": "parameter",
"defaultValue": "RedisConnectionString",
"replaces": "RedisConnectionString"
},
"channel": {
"description": "Redis pubsub channel that the trigger will listen to.",
"type": "parameter",
"defaultValue": "",
"replaces": "redisChannel"
}
},
"primaryOutputs": [
{
"path": "RedisPubSubTriggerCSharp.cs"
}
],
"defaultName": "RedisPubSubTriggerCSharp",
"postActions": [
{
"Description": "Adding Reference to Microsoft.Azure.WebJobs.Extensions.Redis Nuget package",
"ActionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
"ContinueOnError": "true",
"ManualInstructions": [],
"args": {
"referenceType": "package",
"reference": "Microsoft.Azure.WebJobs.Extensions.Redis", "version": "0.5.0-preview",
"projectFileExtensions": ".csproj"
}
},
{
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
"description": "Opens the function class file in the editor",
"manualInstructions": [],
"actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6",
"args": {
"files": "0"
},
"continueOnError": true
}
]
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"name": {
"text": "Redis PubSub Trigger",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "3000"
},
"description": {
"text": "A C# function triggers based on messages from a Redis pubsub channel.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}",
"id": "3001"
},
"order": 400,
"icon": "vs-2017.3/functionF.png",
"learnMoreLink": "https://github.com/Azure/azure-functions-redis-extension",
"uiFilters": [
"functions"
],
"symbolInfo": [
{
"id": "connection",
"name": {
"id": "4100",
"text": "The name of the app setting containing your Redis connection string",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
},
{
"id": "channel",
"name": {
"id": "4101",
"text": "Redis pubsub channel that the trigger will listen to.",
"package": "{E9BCFE2B-304A-4D7F-836F-F3A4FB1A1451}"
},
"isVisible": true
}
]
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 554 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1003 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 527 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 930 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 385 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 635 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 385 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 635 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 735 B

Просмотреть файл

@ -0,0 +1,24 @@
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Redis;
using Microsoft.Extensions.Logging;
namespace Company.Function
{
public static class RedisPubSubTriggerCSharp
{
[FunctionName(nameof(RedisPubSubTriggerCSharp))]
public static void Run(
[RedisPubSubTrigger("RedisConnectionString", "redisChannel")] ChannelMessage message,
ILogger log)
{
log.LogInformation($"Message '{message.Message}' was pushed to channel '{message.Channel}'");
}
}
public class ChannelMessage
{
public string SubscriptionChannel { get; set; }
public string Channel { get; set; }
public string Message { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,13 @@
{
"bindings": [
{
"type": "redisPubSubTrigger",
"name": "message",
"direction": "in",
"connection": "RedisConnectionString",
"channel": "channelname",
"pattern": false
}
],
"disabled": false
}

Просмотреть файл

@ -0,0 +1,15 @@
{
"defaultFunctionName": "RedisPubSubTrigger",
"description": "$RedisPubSubTrigger_description",
"name": "Redis PubSub Trigger",
"language": "C#",
"category": [
"$temp_category_core",
"$temp_category_dataProcessing"
],
"categoryStyle": "other",
"enabledInTryMode": false,
"userPrompt": [
"channel"
]
}

Просмотреть файл

@ -0,0 +1,22 @@
# Redis PubSub Trigger Binding - C#
The `Redis PubSub Trigger Binding` invokes the function on messages published to a channel.
## How it works
For a `RedisPubSubTrigger` to work, you must provide a Redis channel name that defines the pubsub channel that messages will be read from.
Add a `RedisConnectionString` field to your `local.settings.json` with the connection string:
```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"RedisConnectionString": "<cacheName>.redis.cache.windows.net:6380,password=<password>"
}
}
```
## Learn more
For more information, visit the [azure-functions-redis-extension repository](https://github.com/Azure/azure-functions-redis-extension).