问题描述
我只是在尝试找出如何最好地尽快从Azure Service Bus队列中检索消息.
I'm simply trying to work out how best to retrieve messages as quickly as possible from an Azure Service Bus Queue.
我很震惊,因为没有某种方法可以正确地订阅通知队列,而我将不得不进行轮询. (除非我错了,在这种情况下文档很糟糕).
I was shocked that there wasn't some way to properly subscribe to the queue for notifications and that I'm going to have to poll. (unless I'm wrong in which case the documentation is terrible).
我的轮询工作很长,但是每60秒检查一条消息似乎每月需要花费900英镑左右(再次,除非我误解了).而且,如果我添加一个冗余/秒服务来轮询它,则它会加倍.
I got long polling working, but checking a single message every 60 seconds looks like it'll cost around £900 per month (again, unless I've misunderstood that). And if I add a redundant/second service to poll it'll double.
所以我想知道最好/最具成本效益的方式是什么.
So I'm wondering what the best/most cost efficient way of doing it is.
基本上,我只是想从队列中获取一条消息,对一些内部保存的数据执行API查找(也许使用混合服务?),然后再将消息与一些其他信息一起发回到另一个队列中.
Essentially I just want to take a message from the queue, perform an API lookup on some internally held data (perhaps using hybrid services?) and then perhaps post a message back to a different queue with some additional information .
我看着工人的角色(?)-可以做到吗?
I looked at worker roles(?) -- is that something that could do it?
我应该提到,我一直在使用node.js进行此操作.
I should mention that I've been looking at doing this with node.js.
推荐答案
在Azure队列上观看Scott Hanselman和Mark Simms的这些视频.是C#,但您明白了.
Check out these videos from Scott Hanselman and Mark Simms on Azure Queues.It's C# but you get the idea.
https://channel9.msdn.com/Search?term= azure%20queues%20simms#ch9Search
触及:
- 存储队列与服务总线队列
- 批量抓取消息与一对一(粗俗vs.健谈)
- 处理毒药消息(坏演员)
- 其他实施细节
- 我现在不记得了很多东西
对于您的计算,您可以执行VM,辅助角色(云服务),App Service Webjob或Azure Functions.
As for your compute, you can either do a VM, a Worker Role (Cloud Services), App Service Webjobs, or Azure Functions.
Webjobs SDK和Azure Functions机器人可以订阅队列事件(在消息中通知).
The Webjobs SDK and Azure Functions bot have a way to subscribe to Queue events (notify on message).
(从IaaS到PaaS到FaaS-Azure Functions-列出的东西).
(Listed from IaaS to PaaS to FaaS - Azure Functions - if such a thing exists).
Azure Functions已经提供了示例代码作为模板,以使用Node进行所有操作.只需创建一个新功能并按照向导进行操作即可.
Azure Functions already has sample code provided as templates to do all that with Node. Just make a new Function and follow the wizard.
如果需要在企业内部接触数据,则需要与将V2集成到具有企业内部的站点到站点连接的VNET或混合连接(仅适用于App Service!)进行集成. Azure Functions尚不能做到这一点,但其他所有计算都是可以的.
If you need to touch data on-prem you either need to look at integrating with a VNET that has site-to-site connectivity back to your prem, or Hybrid Connections (App Service only!). Azure Functions can't do that yet, but every other compute is a go.
https://azure .microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/(该教程仅是Windows,但是您可以从任何操作系统中提取数据.HybridConnection Manager必须位于Windows机器上,但是它充当网络上任何主机的反向代理.)
https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/(That tutorial is Windows only but you can pull data from any OS. The Hybrid Connection Manager has to live on a Windows box, but then it acts as a reverse proxy to any host on your network).
这篇关于读取Azure Service Bus队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!