我有一个具有事件轮毂绑定触发器的Azure函数,并且接收了一批EventData。我也有固定的elayretry,可以为未经治疗的例外重试(故意完成)。
如果一个事件在批处理中处理过程中失败,那么整个批次将再次重试,这显然会引起重复的问题
,那么我如何确定已成功处理的事件?
是否有一个良好的模式可以存储事件序列编号和在处理之前检查它的状态?以及如何将这些信息作为Azure函数检索是无状态的。
I have an Azure Function which has Event Hub binding trigger and it receives batch of EventData. I also have FixedDelayRetry for enabling retry for unhandled exceptions (done on purpose).
If one event fails during processing it inside a batch then the whole batch is getting retry again which obviously create an issue of duplicates
So how can I identify the events which have been successfully processed?
Is there a good pattern to store event sequence number and the status to check it before processing it? and how to retrieve those information as Azure functions are stateless.
发布评论
评论(1)
根据Microsoft文档创建重复问题,因此不可能进行部分成功。
所有人都成功或失败。有关。
Event Hubs专为每秒数百万个事件而设计,它不是为单个消息处理而设计的。
它在批处理上的工作,它们处理整个批处理,如果批处理失败,则再次重试特定的批次。
您可以使用
尝试捕获块
,如果捕获块引发异常,则在队列中添加此事件,然后用队列触发器调用另一个功能,以处理失败的事件。,因此需要引入
分区键
,这将允许您进行订购处理。According to Microsoft Documents, partial success is not possible.
Either all Succeed or all Fail. More about EventDataBatch Class.
Event hubs is designed for millions of events per second, it's not designed for single message processing.
Its work on batches, they work on whole batch processed and if batch fail then retry the specific batch again.
You can use
try and catch block
, if catch block throws an exception then add this event in Queue and call another function with Queue trigger to process that failed events.If you need to process multiple events in an order so you need to introduce a
Partition key
, which will allow you for ordered processing.