在 Azure 中为匿名 HTTP API 消息创建代理的方法?

Ways to make a broker at Azure for anonymous HTTP API messages?

我们需要 API 在 Azure 上存储通过 HTTP 发送给它(代理)的消息,以防我的系统(云服务)不可用或数据库繁忙。更改要发送的确切消息并不容易。有什么方法可以在 Azure 中创建这样的代理?

服务总线队列看起来很有趣,但据我所知它需要 Shared Access Signatures

另一个 WebRole 应该是一个解决方案,但它需要时间来实现。

带有某种工具(MSMQ?)的虚拟机似乎是一种方法,但它需要维护。

你怎么看?

您的方案是应用以队列为中心的工作模式的主要候选者。

来自http://www.asp.net/aspnet/overview/developing-apps-with-windows-azure/building-real-world-cloud-apps-with-windows-azure/queue-centric-work-pattern

如果您的 Worker(s) 或数据库变得不可用,消息仍会放置在持久存储中并在以后使用。

任务队列可以采用 Azure 存储队列或服务总线队列的形式。在每一个伟大的设计中,完成工作的最不复杂的组件都会获胜。在这种情况下,这将是 Azure 存储队列,耐用、可靠,移动部件很少。除非您绝对需要精确的 FIFO 排序,在这种情况下,您可以使用服务总线。

来自https://msdn.microsoft.com/en-us/library/dn568101.aspx

This solution offers the following benefits:

  • It enables an inherently load-leveled system that can handle wide variations in the volume of requests sent by application instances. The queue acts as a buffer between the application instances and the consumer service instances, which can help to minimize the impact on availability and responsiveness for both the application and the service instances (as described by the Queue-based Load Leveling pattern). Handling a message that requires some long-running processing to be performed does not prevent other messages from being handled concurrently by other instances of the consumer service.

  • It improves reliability. If a producer communicates directly with a consumer instead of using this pattern, but does not monitor the consumer, there is a high probability that messages could be lost or fail to be processed if the consumer fails. In this pattern messages are not sent to a specific service instance, a failed service instance will not block a producer, and messages can be processed by any working service instance.

  • It does not require complex coordination between the consumers, or between the producer and the consumer instances. The message queue ensures that each message is delivered at least once.

  • It is scalable. The system can dynamically increase or decrease the number of instances of the consumer service as the volume of messages fluctuates.

  • It can improve resiliency if the message queue provides transactional read operations. If a consumer service instance reads and processes the message as part of a transactional operation, and if this consumer service instance subsequently fails, this pattern can ensure that the message will be returned to the queue to be picked up and handled by another instance of the consumer service.

鉴于您无法更改客户端,我会代理调用。使用 Azure 中的 API 管理服务重新创建 API,并将 Web url 更改为指向 API 管理服务代理。

代理可以轻松委托给 function application like Aravind mentioned in the comments to your question by using the API Management Service policies.