Azure Durable Function 中的状态在哪里?
Where is the state in Azure Durable Function?
我正在构建一个 Azure Durable Function 应用程序,它每天由计时器触发 1 次。出于某种原因,我想保留之前 运行 的状态(例如令牌或数组),这可能吗?
很多官方文档都会从 Azure Durable Function is statefull 开始,我只知道一个 activity 的输出可以用作另一个 activity 的输入。而 Chris Gillum 只是跳过了 youtube 视频中的那个话题
这在一定程度上取决于您将如何需要该状态。如果对象是一个 activity 函数的输出并传递给另一个函数,那么您可以使用 Sajeetha运行 等函数链模式,因为 activity 函数的输入默认保留.
但是如果你想在更长的时间内捕获对象的状态(即上次你的定时器功能运行)你可以查看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.
Chris Gillum 写了一篇关于它的文章:https://medium.com/@cgillum/azure-functions-durable-entities-67db648d2f74
如果您不能使用此预览版或不喜欢这个概念,您仍然可以编写 activity 具有 input & output bindings 到 table 的函数 - 或者 blob 存储或 CosmosDB 和自己管理状态。
我正在构建一个 Azure Durable Function 应用程序,它每天由计时器触发 1 次。出于某种原因,我想保留之前 运行 的状态(例如令牌或数组),这可能吗?
很多官方文档都会从 Azure Durable Function is statefull 开始,我只知道一个 activity 的输出可以用作另一个 activity 的输入。而 Chris Gillum 只是跳过了 youtube 视频中的那个话题
这在一定程度上取决于您将如何需要该状态。如果对象是一个 activity 函数的输出并传递给另一个函数,那么您可以使用 Sajeetha运行 等函数链模式,因为 activity 函数的输入默认保留.
但是如果你想在更长的时间内捕获对象的状态(即上次你的定时器功能运行)你可以查看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.
Chris Gillum 写了一篇关于它的文章:https://medium.com/@cgillum/azure-functions-durable-entities-67db648d2f74
如果您不能使用此预览版或不喜欢这个概念,您仍然可以编写 activity 具有 input & output bindings 到 table 的函数 - 或者 blob 存储或 CosmosDB 和自己管理状态。