Skip to content

Commit af370ee

Browse files
authored
Merge pull request #280752 from flang-msft/fxl---RedisPubSubTrigger-is-missing-information-for-functions.json--ado-28336022
Fxl---redis pub sub trigger is missing information for functions.json ado 28336022
2 parents f0aa997 + cfc9043 commit af370ee

6 files changed

+49
-31
lines changed

articles/azure-functions/functions-bindings-cache-input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: franlanglois
66
ms.service: azure-functions
77
ms.custom: devx-track-extended-java, devx-track-js, devx-track-python
88
ms.topic: reference
9-
ms.date: 05/20/2024
9+
ms.date: 07/12/2024
1010
zone_pivot_groups: programming-languages-set-functions-lang-workers
1111
---
1212

articles/azure-functions/functions-bindings-cache-output.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: franlanglois
77
ms.service: azure-functions
88
ms.custom: devx-track-extended-java, devx-track-js, devx-track-python
99
ms.topic: reference
10-
ms.date: 02/27/2024
10+
ms.date: 07/12/2024
1111
---
1212

1313
# Azure Cache for Redis output binding for Azure Functions
@@ -40,45 +40,48 @@ The following example shows a pub/sub trigger on the set event with an output bi
4040
>
4141
>For .NET functions, using the _isolated worker_ model is recommended over the _in-process_ model. For a comparison of the _in-process_ and _isolated worker_ models, see differences between the _isolated worker_ model and the _in-process_ model for .NET on Azure Functions.
4242
43-
### [In-process](#tab/in-process)
43+
### [Isolated process](#tab/isolated-process)
4444

4545
```c#
46+
4647
using Microsoft.Extensions.Logging;
4748

48-
namespace Microsoft.Azure.WebJobs.Extensions.Redis.Samples.RedisOutputBinding
49+
namespace Microsoft.Azure.Functions.Worker.Extensions.Redis.Samples.RedisOutputBinding
4950
{
5051
internal class SetDeleter
5152
{
52-
[FunctionName(nameof(SetDeleter))]
53-
public static void Run(
54-
[RedisPubSubTrigger(Common.connectionStringSetting, "__keyevent@0__:set")] string key,
55-
[Redis(Common.connectionStringSetting, "DEL")] out string[] arguments,
53+
[Function(nameof(SetDeleter))]
54+
[RedisOutput(Common.connectionString, "DEL")]
55+
public static string Run(
56+
[RedisPubSubTrigger(Common.connectionString, "__keyevent@0__:set")] string key,
5657
ILogger logger)
5758
{
5859
logger.LogInformation($"Deleting recently SET key '{key}'");
59-
arguments = new string[] { key };
60+
return key;
6061
}
6162
}
6263
}
6364
```
6465

65-
### [Isolated process](#tab/isolated-process)
66+
---
67+
68+
### [In-process](#tab/in-process)
6669

6770
```csharp
68-
using Microsoft.Extensions.Logging;
71+
using Microsoft.Extensions.Logging;
6972

7073
namespace Microsoft.Azure.WebJobs.Extensions.Redis.Samples.RedisOutputBinding
7174
{
7275
internal class SetDeleter
7376
{
7477
[FunctionName(nameof(SetDeleter))]
75-
[return: Redis(Common.connectionStringSetting, "DEL")]
76-
public static string Run(
78+
public static void Run(
7779
[RedisPubSubTrigger(Common.connectionStringSetting, "__keyevent@0__:set")] string key,
80+
[Redis(Common.connectionStringSetting, "DEL")] out string[] arguments,
7881
ILogger logger)
7982
{
8083
logger.LogInformation($"Deleting recently SET key '{key}'");
81-
return key;
84+
arguments = new string[] { key };
8285
}
8386
}
8487
}

articles/azure-functions/functions-bindings-cache-trigger-redislist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: franlanglois
88
ms.service: azure-functions
99
ms.custom: devx-track-extended-java, devx-track-js, devx-track-python
1010
ms.topic: reference
11-
ms.date: 05/20/2024
11+
ms.date: 07/12/2024
1212
---
1313

1414
# RedisListTrigger for Azure Functions

articles/azure-functions/functions-bindings-cache-trigger-redispubsub.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: franlanglois
88
ms.service: azure-functions
99
ms.custom: devx-track-dotnet, devx-track-extended-java, devx-track-js, devx-track-python
1010
ms.topic: reference
11-
ms.date: 05/20/2024
11+
ms.date: 07/12/2024
1212
---
1313

1414
# RedisPubSubTrigger for Azure Functions
@@ -218,12 +218,15 @@ public class SimplePubSubTrigger {
218218
@RedisPubSubTrigger(
219219
name = "req",
220220
connection = "redisConnectionString",
221-
channel = "pubsubTest")
221+
channel = "pubsubTest",
222+
pattern = false)
222223
String message,
223224
final ExecutionContext context) {
224225
context.getLogger().info(message);
225226
}
226227
}
228+
229+
227230
```
228231

229232
This sample listens to any keyspace notifications for the key `myKey`.
@@ -241,12 +244,14 @@ public class KeyspaceTrigger {
241244
@RedisPubSubTrigger(
242245
name = "req",
243246
connection = "redisConnectionString",
244-
channel = "__keyspace@0__:keyspaceTest")
247+
channel = "__keyspace@0__:keyspaceTest",
248+
pattern = false)
245249
String message,
246250
final ExecutionContext context) {
247251
context.getLogger().info(message);
248252
}
249253
}
254+
250255
```
251256

252257
This sample listens to any `keyevent` notifications for the delete command [`DEL`](https://redis.io/commands/del/).
@@ -264,7 +269,8 @@ public class KeyeventTrigger {
264269
@RedisPubSubTrigger(
265270
name = "req",
266271
connection = "redisConnectionString",
267-
channel = "__keyevent@0__:del")
272+
channel = "__keyevent@0__:del",
273+
pattern = false)
268274
String message,
269275
final ExecutionContext context) {
270276
context.getLogger().info(message);
@@ -298,6 +304,7 @@ Here's binding data to listen to the channel `pubsubTest`.
298304
"type": "redisPubSubTrigger",
299305
"connection": "redisConnectionString",
300306
"channel": "pubsubTest",
307+
"pattern": false,
301308
"name": "message",
302309
"direction": "in"
303310
}
@@ -315,6 +322,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
315322
"type": "redisPubSubTrigger",
316323
"connection": "redisConnectionString",
317324
"channel": "__keyspace@0__:keyspaceTest",
325+
"pattern": false,
318326
"name": "message",
319327
"direction": "in"
320328
}
@@ -332,6 +340,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
332340
"type": "redisPubSubTrigger",
333341
"connection": "redisConnectionString",
334342
"channel": "__keyevent@0__:del",
343+
"pattern": false,
335344
"name": "message",
336345
"direction": "in"
337346
}
@@ -372,6 +381,7 @@ Here's binding data to listen to the channel `pubsubTest`.
372381
"type": "redisPubSubTrigger",
373382
"connection": "redisConnectionString",
374383
"channel": "pubsubTest",
384+
"pattern": false,
375385
"name": "message",
376386
"direction": "in"
377387
}
@@ -389,6 +399,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
389399
"type": "redisPubSubTrigger",
390400
"connection": "redisConnectionString",
391401
"channel": "__keyspace@0__:keyspaceTest",
402+
"pattern": false,
392403
"name": "message",
393404
"direction": "in"
394405
}
@@ -406,6 +417,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
406417
"type": "redisPubSubTrigger",
407418
"connection": "redisConnectionString",
408419
"channel": "__keyevent@0__:del",
420+
"pattern": false,
409421
"name": "message",
410422
"direction": "in"
411423
}
@@ -443,6 +455,7 @@ Here's binding data to listen to the channel `pubsubTest`.
443455
"type": "redisPubSubTrigger",
444456
"connection": "redisConnectionString",
445457
"channel": "pubsubTest",
458+
"pattern": false,
446459
"name": "message",
447460
"direction": "in"
448461
}
@@ -460,6 +473,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
460473
"type": "redisPubSubTrigger",
461474
"connection": "redisConnectionString",
462475
"channel": "__keyspace@0__:keyspaceTest",
476+
"pattern": false,
463477
"name": "message",
464478
"direction": "in"
465479
}
@@ -477,6 +491,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
477491
"type": "redisPubSubTrigger",
478492
"connection": "redisConnectionString",
479493
"channel": "__keyevent@0__:del",
494+
"pattern": false,
480495
"name": "message",
481496
"direction": "in"
482497
}
@@ -520,13 +535,14 @@ Here's binding data to listen to `keyevent` notifications for the delete command
520535

521536
## Configuration
522537

523-
| function.json property | Description | Required | Default |
524-
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| :-----:| -----:|
525-
| `type` | Trigger type. For the pub sub trigger, the type is `redisPubSubTrigger`. | Yes | |
526-
| `connection` | The name of the [application setting](functions-how-to-use-azure-function-app-settings.md#settings) that contains the cache connection string, such as: `<cacheName>.redis.cache.windows.net:6380,password...`| Yes | |
527-
| `channel` | Name of the pub sub channel that is being subscribed to | Yes | |
528-
| `name` | Name of the variable holding the value returned by the function. | Yes | |
529-
| `direction` | Must be set to `in`. | Yes | |
538+
| function.json property | Description | Required | Default |
539+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:--------:| -------:|
540+
| `type` | Trigger type. For the pub sub trigger, the type is `redisPubSubTrigger`. | Yes | |
541+
| `connection` | The name of the [application setting](functions-how-to-use-azure-function-app-settings.md#settings) that contains the cache connection string, such as: `<cacheName>.redis.cache.windows.net:6380,password...` | Yes | |
542+
| `channel` | Name of the pub sub channel that is being subscribed to. | Yes | |
543+
| `pattern` | A boolean to indicate the given channel uses pattern mathching. If `pattern` is true, then the channel is treated like a _glob-style_ pattern instead of as a literal. | Yes | |
544+
| `name` | Name of the variable holding the value returned by the function. | Yes | |
545+
| `direction` | Must be set to `in`. | Yes | |
530546

531547
::: zone-end
532548

articles/azure-functions/functions-bindings-cache-trigger-redisstream.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: franlanglois
88
ms.service: azure-functions
99
ms.custom: devx-track-dotnet, devx-track-extended-java, devx-track-js, devx-track-python
1010
ms.topic: reference
11-
ms.date: 05/20/2024
11+
ms.date: 07/12/2024
1212
---
1313

1414
# RedisStreamTrigger for Azure Functions
@@ -48,7 +48,6 @@ The `RedisStreamTrigger` reads new entries from a stream and surfaces those elem
4848

4949
### [Isolated worker model](#tab/isolated-process)
5050

51-
5251
```csharp
5352
using Microsoft.Extensions.Logging;
5453

articles/azure-functions/functions-bindings-cache.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Using Azure Functions for Azure Cache for Redis (preview)
2+
title: Using Azure Functions for Azure Cache for Redis
33
description: Learn how to use Azure Functions Azure Cache for Redis
44
author: flang-msft
55
zone_pivot_groups: programming-languages-set-functions-lang-workers
@@ -8,10 +8,10 @@ ms.author: franlanglois
88
ms.service: azure-functions
99
ms.custom: devx-track-extended-java, devx-track-js, devx-track-python
1010
ms.topic: reference
11-
ms.date: 03/01/2024
11+
ms.date: 07/11/2024
1212
---
1313

14-
# Overview of Azure functions for Azure Cache for Redis (preview)
14+
# Overview of Azure functions for Azure Cache for Redis
1515

1616
This article describes how to use Azure Cache for Redis with Azure Functions to create optimized serverless and event-driven architectures.
1717

0 commit comments

Comments
 (0)