主题不包含字符串的 Azure EventGrid 高级筛选器

Azure EventGrid Advanced Filter where Subject does not contain string

场景:

关键词:主题

运算符: 字符串以

结尾

值:.txt、.json等

我现在需要过滤哪些 Blob 容器 触发 EventGrid 消息。

示例事件网格主题:

"subject": "/blobServices/default/containers/vnd-test/blobs/sample.zip"

当 blob 上传到 vnd-test 容器时,如何使用 EventGrid 高级过滤器不触发?

尝试过:

关键词:主题

运算符:字符串不在

值: vnd-test

但是 EventGrid 消息仍然触发并触发函数。

想法?

How do I use EventGrid Advanced Filters to NOT TRIGGER when blobs are uploaded to vnd-test container?

我知道你想做什么,但是现在事件网格中没有对应的算子来实现你的想法。

我可以简单地向你解释为什么事件网格不拒绝接收发送到 vnd-test 容器的事件。

blob 创建事件的结构如下:

[{
  "topic": "/subscriptions/{subscription-id}/resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/my-storage-account",
  "subject": "/blobServices/default/containers/test-container/blobs/new-file.txt",
  "eventType": "Microsoft.Storage.BlobCreated",
  "eventTime": "2017-06-26T18:41:00.9584103Z",
  "id": "831e1650-001e-001b-66ab-eeb76e069631",
  "data": {
    "api": "PutBlockList",
    "clientRequestId": "6d79dbfb-0e37-4fc4-981f-442c9ca65760",
    "requestId": "831e1650-001e-001b-66ab-eeb76e000000",
    "eTag": "\"0x8D4BCC2E4835CD0\"",
    "contentType": "text/plain",
    "contentLength": 524288,
    "blobType": "BlockBlob",
    "url": "https://my-storage-account.blob.core.windows.net/testcontainer/new-file.txt",
    "sequencer": "00000000000004420000000000028963",
    "storageDiagnostics": {
      "batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"
    }
  },
  "dataVersion": "",
  "metadataVersion": "1"
}]

当你设置subjectstring is not in["vnd-test"],其实是在做:

例如,如果一个名为 111.txt 的文件被发送到 vnd-test。它进行以下思考过程:

1、/blobServices/default/containers/vnd-test/111.txt是集合["vnd-test"]的元素之一吗?

2、不,不是。太棒了!我会接受这个活动,因为它符合条件。

3、事件网格很高兴创建 blobcreated 事件并将此事件发送到函数端点,因此您的函数被触发

不将subject中的部分字符串与vnd-test进行比较,而是将整个subject与vnd-test进行比较。但是,主题细化到blob级别,怎么可能把每一个可能的blob都写到集合中呢?当前运营商不支持你的想法