gpt4 book ai didi

azure - Azure Durable Function 中的状态在哪里?

转载 作者:行者123 更新时间:2023-12-04 15:42:14 24 4
gpt4 key购买 nike

我正在构建一个Azure Durable Function App,它每天由定时器触发1次。出于某种原因,我想保留上次运行的状态(例如 token 或数组),这可能吗?

很多官方文档都会以Azure Durable Function is statefull开头,我只知道一个事件的输出可以用作另一个事件的输入。克里斯·吉勒姆 (Chris Gillum) 在 YouTube 视频中跳过了该主题

最佳答案

这在某种程度上取决于您如何需要该状态。如果对象是一个事件函数的输出并传递到另一个事件函数,那么您可以使用函数链接模式,例如所描述的 Sajeetharan,因为默认情况下会保留事件函数的输入。

但是,如果您想在较长时间内捕获对象的状态(即计时器函数上次运行的时间),您可以查看 Durable Entities (在撰写本文时仍处于预览状态):

Entity functions define operations for reading and updating small pieces of state, known as durable entities. Like orchestrator functions, entity functions are functions with a special trigger type, entity trigger. Unlike orchestrator functions, entity functions do not have any specific code constraints. Entity functions also manage state explicitly rather than implicitly representing state via control flow.

克里斯·吉勒姆写了一篇关于它的文章:https://medium.com/@cgillum/azure-functions-durable-entities-67db648d2f74

如果您无法使用此预览版本或不喜欢概念,您仍然可以编写具有 input & output bindings 的事件函数。到表或 blob 存储或 CosmosDB 并自行管理状态。

关于azure - Azure Durable Function 中的状态在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57455411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com