增加 EventGrid 的事件大小,以防止 413 Payload Too Large

Increase EventGrid's event size, to prevent 413 Payload Too Large

某些发布到 Azure EventGrid 实例的消息会导致 413 负载太大 错误。 docs are quite clear on this:

When posting events to an event grid topic, the array can have a total size of up to 1 MB. Each event in the array is limited to 64 KB. If an event or the array is greater than the size limits, you receive the response 413 Payload Too Large.

不幸的是,我 运行 进入这个问题太晚了,直到我在生产中遇到错误才意识到这个事件大小限制。减小正文大小是可行的方法,因为我知道消息的占用空间应该很小。他们中的大多数是。但是对于少数失败的消息,它需要大量的管道和架构更改。

在此之前,Azure EventGrid 是否有合理增加 64kb 限制(例如增加到 128kb)的方法,尽管有设置、更高的计划或解决方法?直到可以通过代码更改正确地解决这个问题。

64KB 限制是硬性限制。你无法改变这一点。您可以使用声明检查模式将事件数据卸载到存储并在收到消息时读取它。

截至 2019 年 5 月底,officially announced 事件网格现在支持最大 1MB 的事件。为了使用公告状态:

... There are no configuration changes required, and this will work on existing event subscriptions. To try it out, just push larger events. Everything under 64 KB will be still be covered by our GA SLA.

这得到了 the docs which now formally mention 的支持:

... Support for 64 KB in General Availability (GA). Support for 1 MB is currently in preview.

虽然还没有正式发布,但这是非常有前途的并且已经可以使用了。这回答了我原来的问题。

我同意 Sean 关于使用 ClaimCheck 模式的观点。我从事大型 EDA 工作已有 20 年,并且一直强调保持事件消息小而灵活(无论技术平台如何)的必要性。我认为在事件有效负载中携带指向 blob(例如)的指针仍然是一种很好的做法。但是,我很想了解为什么 MS 决定将其限制提高到 1MB。这只会让架构师的工作在试图说服其他人相信 'small & nimble events' 原则时变得更加困难。