简体   繁体   English

Azure EventGrid 高级筛选器,其中主题不包含字符串

[英]Azure EventGrid Advanced Filter where Subject does not contain string

Scenario:设想:

  • EventGrid-triggered Azure Function事件网格触发 Azure Function
  • EventGrid messages created when blobs uploaded to any container within a Storage Account当 blob 上传到存储帐户中的任何容器时创建的 EventGrid 消息
  • I am successfully limiting EventGrid messages, using Advanced Filters, for the following FileTypes我使用高级过滤器成功限制了以下文件类型的 EventGrid 消息

Key: Subject关键:主题

Operator: String ends with运算符:字符串以

Value: .txt, .json etc.值: .txt、.json 等。

在此处输入图像描述

I now need to filter which Blob Containers trigger an EventGrid message.我现在需要过滤哪些Blob 容器触发 EventGrid 消息。

Sample EventGrid Subject:示例 EventGrid 主题:

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

How do I use EventGrid Advanced Filters to NOT TRIGGER when blobs are uploaded to vnd-test container?当 blob 上传到vnd-test容器时,如何使用 EventGrid 高级过滤器不触发?

Tried:试过:

Key: Subject关键:主题

Operator: String is not in操作员:字符串不在

Value: vnd-test值: vnd-test

But the EventGrid message still fires and triggers the Function.但是 EventGrid 消息仍然会触发并触发 Function。

Ideas?想法?

在此处输入图像描述

How do I use EventGrid Advanced Filters to NOT TRIGGER when blobs are uploaded to vnd-test container?当 blob 上传到 vnd-test 容器时,如何使用 EventGrid 高级过滤器不触发?

I know what you want to do, but now there is no corresponding operatorto implement your idea in the event grid.我知道你想做什么,但是现在事件网格中没有对应的算子来实现你的想法。

I can briefly explain to you why the event grid does not refuse to receive events sent to the vnd-test container.我可以简单地向您解释为什么事件网格不拒绝接收发送到 vnd-test 容器的事件。

The structure of blob created event is like below: 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"
}]

When you set subject string is not in ["vnd-test"] , in fact it is doing:当您设置subject string is not in ["vnd-test"]中时,实际上它正在做:

For example, if a file named 111.txt been sended to vnd-test.例如,如果一个名为 111.txt 的文件被发送到 vnd-test。 It conducts the following thought process:它进行以下思考过程:

1, Is /blobServices/default/containers/vnd-test/111.txt one of the elements of the collection ["vnd-test"] ? 1, /blobServices/default/containers/vnd-test/111.txt是集合["vnd-test"]的元素之一吗?

2, No, it is not. 2、不,不是。 That is great.太棒了。 I will accept this event because it meets the condition.我会接受这个事件,因为它符合条件。

3, event grid was very happy to create the blobcreated event and send this event to the function endpoint, so your function is triggered 3、事件网格非常高兴地创建了blobcreated事件并将这个事件发送到function端点,所以你的function被触发

It does not compare part of the string inside the subject with vnd-test, but uses the entire subject to compare with vnd-test.它不将主题内部的部分字符串与 vnd-test 进行比较,而是使用整个主题与 vnd-test 进行比较。 However, the subject is refined to the blob level, how can it be possible to write every possible blob to the collection?但是,主题细化到blob级别,怎么可能把每一个可能的blob都写到集合中呢? The current operator does not support your idea.当前运营商不支持您的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM