Azure函数中具有多个输出的事务 [英] Transactions in Azure Functions with multiple outputs

查看:50
本文介绍了Azure函数中具有多个输出的事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Azure函数中具有多个输出绑定时,我们应该如何处理事务,我必须保证已成功写入所有输出?运行时是否提供某种分布式事务处理,还是我必须自己构建所有内容?

How are we supposed to handle transactions when having multiple output bindings in an Azure function and i have to guarantee that writing to all of the outputs has succeeded? Does the runtime provide some sort of distributed transaction handling or do i have to build everything myself?

例如,我绑定到DocumentDb和Blob存储.由于某种原因,写入Blob存储失败.是否有可能回滚整个操作?

For example i have a binding to DocumentDb and to Blob Storage. For some reason writing to Blob Storage fails. Is there a possiblity to rollback the whole operation?

推荐答案

运行时不提供多个输出之间的任何事务保证.如果第一个输出成功,然后第二个失败,则可能会导致状态不一致.

Runtime does not provide any transactional guarantees between multiple outputs. If first output succeeds, and then second one fails, you might end up in inconsistent state.

一种解决方法是将触发器类型与重试配合使用(例如,服务总线),并使所有输出均等幂.

One workaround is to use trigger type with retries (e.g. Service Bus), and make all outputs idempotent.

这篇关于Azure函数中具有多个输出的事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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