Reading Azure Service Bus Queue

后端 未结 2 868
既然无缘
既然无缘 2020-12-22 01:13

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 pr

相关标签:
2条回答
  • 2020-12-22 01:36

    To deal with Azure ServiceBus Queue easily, the best option seems to be Azure Webjob.

    There is a ServiceBusTrigger that allows you to get messages from an Azure ServiceBus queue.

    For node.js integration, you should have a look at Azure Function. It is built on top of the webjob SDK and have node.js integration :

    • Azure Functions NodeJS developer reference
    • Azure Functions Service Bus triggers and bindings for queues and topics

    In the second article, there is an example on how get messages from a queue using Azure Function and nodejs :

    module.exports = function(context, myQueueItem) {
        context.log('Node.js ServiceBus queue trigger function processed message', myQueueItem);
        context.done();
    };
    
    0 讨论(0)
  • 2020-12-22 01:53

    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

    Touches on:

    • Storage Queues vs. Service Bus Queues
    • Grabbing messages in bulk vs. one by one (chunky vs. chatty)
    • Dealing with poison messages (bad actors)
    • Misc implementation details
    • Much more stuff i can't remember now

    As for your compute, you can either do a VM, a Worker Role (Cloud Services), App Service Webjobs, or Azure Functions.

    The Webjobs SDK and Azure Functions bot have a way to subscribe to Queue events (notify on message).

    (Listed from IaaS to PaaS to FaaS - Azure Functions - if such a thing exists).

    Azure Functions already has sample code provided as templates to do all that with Node. Just make a new Function and follow the wizard.

    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/ (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).

    0 讨论(0)
提交回复
热议问题