Azure耐用的功能作为消息队列

发布于 2025-02-06 06:34:19 字数 593 浏览 2 评论 0原文

我有一个无服务器功能,可以接收订单,每天约30个。此功能取决于第三方API,以执行一些其他查找和检查。但是,此外部端点不是100%可靠的,如果其他API在几个小时内(或更多..),我需要能够存储订单请求。

我最初的想法是将功能分为两个,第一部分将接收订单,进行一些初始检查,例如验证订单,然后将请求发布到消息队列或pub/sub系统中。另一方面,有一个消费者读取订单并试图执行API请求,如果API不可用,则订单将返回队列。

但是,有人建议我简单地使用Azure耐用函数为请求使用,然后使用 contregator模式(尤其是因为API会工作99.99 ..在时间的含量为99.99 ..%)。这将使体系结构变得更加简单。

使用一种优点/缺点是什么优点/缺点,我是否缺少任何重要的考虑因素? 感谢您的任何见解或其他建议。让我知道是否需要其他信息。

I have a serverless function that receives orders, about ~30 per day. This function is depending on a third-party API to perform some additional lookups and checks. However, this external endpoint isn't 100% reliable and I need to be able to store order requests if the other API isn't available for a couple of hours (or more..).

My initial thought was to split the function into two, the first part would receive orders, do some initial checks such as validating the order, then post the request into a message queue or pub/sub system. On the other side, there's a consumer that reads orders and tries to perform the API requests, if the API isn't available the orders get posted back into the queue.

However, someone suggested to me to simply use an Azure Durable Function for the requests, and store the current backlog in the function state, using the Aggregator Pattern (especially since the API will be working find 99.99..% of the time). This would make the architecture a lot simpler.

What are the advantages/disadvantages of using one over the other, am I missing any important considerations?
I would appreciate any insight or other suggestions you have. Let me know if additional information is needed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失与倦" 2025-02-13 06:34:19

您可以使用持久的任务框架或Azure存储或服务总线队列解决此问题,但是在您的交易量中,我认为这会使解决方案过度复杂化。

如果您每天要处理〜30个订单,请考虑一种简单的解决方案之一:

  • 使用 polly ,支持良好的弹性和耐故障框架。
  • 将请求信息写入您的数据库。有一个Azure功能计时器触发偶尔读取,并完成未标记为完整的处理订单。

当您进入严重的音量时,耐用的任务框架非常好。但是,该框架有一个非平凡的学习曲线。

You could solve this problem with Durable Task Framework or Azure Storage or Service Bus Queues, but at your transaction volume, I think that's overcomplicating the solution.

If you're dealing with ~30 orders per day, consider one of the simpler solutions:

  • Use Polly, a well-supported resilience and fault-tolerance framework.
  • Write request information to your database. Have an Azure Function Timer Trigger read occasionally and finish processing orders that aren't marked as complete.

Durable Task Framework is great when you get into serious volume. But there's a non-trivial learning curve for the framework.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文