为什么ResourceWriteSuccess的事件网格订阅使用不同的eventId多次触发? [英] Why are Event Grid Subscriptions for ResourceWriteSuccess firing multiple times with different eventIds?

查看:92
本文介绍了为什么ResourceWriteSuccess的事件网格订阅使用不同的eventId多次触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为资源组创建了一个事件网格订阅",并监听了事件"Microsoft.Resources.ResourceWriteSuccess".通过向我的API发送一个Webhook来处理该事件,该Webhook返回200(我确认我的API没问题,它正在响应 适当地).我正在通过Azure REST管理API创建Azure SQL数据库.

I have created an Event Grid Subscription for a resource group and listen for the event 'Microsoft.Resources.ResourceWriteSuccess'. The event is handled by sending a webhook to my API, which is returning a 200 (I verified my API is not at fault, it is responding properly). I am creating the Azure SQL Databases via the Azure REST Management API.

事件发送成功;但是,似乎正在发送相同的事件,但是具有不同的eventId(仅在有效负载中为"id")和不同的eventTimes.我在两个有效负载之间运行了差异检查器,以确保它是同一事件.我是 使用不同的eventId和不同的时间戳多次获取ResourceWriteSuccess.我看不到如何将数据库多次写入资源组.

Events are sent successfully; however, it appears that the same events are being sent, but with different eventIds (simply 'id' in the payload), and different eventTimes. I ran a diff checker between two payloads to ensure that it was the same event. I am getting ResourceWriteSuccess multiple times with a different eventId, and a different timestamp. I don't see how the database is being written multiple times to a resource group.

这对我来说是个问题,因为为了保持幂等性,我的控制器正在检查是否已处理了eventId(我将已处理的webhooks存储在数据库中).我不想为已经发生的事件运行逻辑.

This is problematic for me, because to maintain idempotency, my controller's are checking to see if that eventId has been handled (I store the webhooks that have been handled in my db). I don't want to be running logic for an event that already happened.

推荐答案

科林,

我不确定我是否完全理解您的问题.看来创建Azure SQL数据库"是事件网格生成的上游活动中的下游事件...

I am not sure I completely understand your question or issue. It appears that the 'creating the Azure SQL Databases' is a downstream event from a upstream activity generated by Event Grid...

什么是活动?是否为每个事件"创建一个新的SQL数据库?您可以绘制此图并附加(或发送到Microsoft.com的AzCommunity)吗?

What are the Events? And is a new SQL database being created for each 'Event'? Is it possible for you to diagram this and attach (or send to AzCommunity at Microsoft.com)?

谢谢

迈克


这篇关于为什么ResourceWriteSuccess的事件网格订阅使用不同的eventId多次触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆