@@ -218,12 +218,15 @@ public class SimplePubSubTrigger {
218
218
@RedisPubSubTrigger (
219
219
name = " req" ,
220
220
connection = " redisConnectionString" ,
221
- channel = " pubsubTest" )
221
+ channel = " pubsubTest" ,
222
+ pattern = false )
222
223
String message ,
223
224
final ExecutionContext context ) {
224
225
context. getLogger(). info(message);
225
226
}
226
227
}
228
+
229
+
227
230
```
228
231
229
232
This sample listens to any keyspace notifications for the key ` myKey ` .
@@ -241,12 +244,14 @@ public class KeyspaceTrigger {
241
244
@RedisPubSubTrigger (
242
245
name = " req" ,
243
246
connection = " redisConnectionString" ,
244
- channel = " __keyspace@0__:keyspaceTest" )
247
+ channel = " __keyspace@0__:keyspaceTest" ,
248
+ pattern = false )
245
249
String message ,
246
250
final ExecutionContext context ) {
247
251
context. getLogger(). info(message);
248
252
}
249
253
}
254
+
250
255
```
251
256
252
257
This sample listens to any ` keyevent ` notifications for the delete command [ ` DEL ` ] ( https://redis.io/commands/del/ ) .
@@ -264,7 +269,8 @@ public class KeyeventTrigger {
264
269
@RedisPubSubTrigger (
265
270
name = " req" ,
266
271
connection = " redisConnectionString" ,
267
- channel = " __keyevent@0__:del" )
272
+ channel = " __keyevent@0__:del" ,
273
+ pattern = false )
268
274
String message ,
269
275
final ExecutionContext context ) {
270
276
context. getLogger(). info(message);
@@ -298,6 +304,7 @@ Here's binding data to listen to the channel `pubsubTest`.
298
304
"type" : " redisPubSubTrigger" ,
299
305
"connection" : " redisConnectionString" ,
300
306
"channel" : " pubsubTest" ,
307
+ "pattern" : false ,
301
308
"name" : " message" ,
302
309
"direction" : " in"
303
310
}
@@ -315,6 +322,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
315
322
"type" : " redisPubSubTrigger" ,
316
323
"connection" : " redisConnectionString" ,
317
324
"channel" : " __keyspace@0__:keyspaceTest" ,
325
+ "pattern" : false ,
318
326
"name" : " message" ,
319
327
"direction" : " in"
320
328
}
@@ -332,6 +340,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
332
340
"type" : " redisPubSubTrigger" ,
333
341
"connection" : " redisConnectionString" ,
334
342
"channel" : " __keyevent@0__:del" ,
343
+ "pattern" : false ,
335
344
"name" : " message" ,
336
345
"direction" : " in"
337
346
}
@@ -372,6 +381,7 @@ Here's binding data to listen to the channel `pubsubTest`.
372
381
"type" : " redisPubSubTrigger" ,
373
382
"connection" : " redisConnectionString" ,
374
383
"channel" : " pubsubTest" ,
384
+ "pattern" : false ,
375
385
"name" : " message" ,
376
386
"direction" : " in"
377
387
}
@@ -389,6 +399,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
389
399
"type" : " redisPubSubTrigger" ,
390
400
"connection" : " redisConnectionString" ,
391
401
"channel" : " __keyspace@0__:keyspaceTest" ,
402
+ "pattern" : false ,
392
403
"name" : " message" ,
393
404
"direction" : " in"
394
405
}
@@ -406,6 +417,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
406
417
"type" : " redisPubSubTrigger" ,
407
418
"connection" : " redisConnectionString" ,
408
419
"channel" : " __keyevent@0__:del" ,
420
+ "pattern" : false ,
409
421
"name" : " message" ,
410
422
"direction" : " in"
411
423
}
@@ -443,6 +455,7 @@ Here's binding data to listen to the channel `pubsubTest`.
443
455
"type" : " redisPubSubTrigger" ,
444
456
"connection" : " redisConnectionString" ,
445
457
"channel" : " pubsubTest" ,
458
+ "pattern" : false ,
446
459
"name" : " message" ,
447
460
"direction" : " in"
448
461
}
@@ -460,6 +473,7 @@ Here's binding data to listen to keyspace notifications for the key `keyspaceTes
460
473
"type" : " redisPubSubTrigger" ,
461
474
"connection" : " redisConnectionString" ,
462
475
"channel" : " __keyspace@0__:keyspaceTest" ,
476
+ "pattern" : false ,
463
477
"name" : " message" ,
464
478
"direction" : " in"
465
479
}
@@ -477,6 +491,7 @@ Here's binding data to listen to `keyevent` notifications for the delete command
477
491
"type" : " redisPubSubTrigger" ,
478
492
"connection" : " redisConnectionString" ,
479
493
"channel" : " __keyevent@0__:del" ,
494
+ "pattern" : false ,
480
495
"name" : " message" ,
481
496
"direction" : " in"
482
497
}
@@ -520,13 +535,14 @@ Here's binding data to listen to `keyevent` notifications for the delete command
520
535
521
536
## Configuration
522
537
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 ` | If the channel is a pattern. | | |
544
+ | ` name ` | Name of the variable holding the value returned by the function. | Yes | |
545
+ | ` direction ` | Must be set to ` in ` . | Yes | |
530
546
531
547
::: zone-end
532
548
0 commit comments