Using SignalR in Azure Worker Roles

前端 未结 5 1588
清酒与你
清酒与你 2021-02-05 18:53

I have an Azure hosted web application which works alongside a number of instances of a worker role. Currently the web app passes work to these workers by placing messages in an

相关标签:
5条回答
  • 2021-02-05 19:00

    We use Azure Service Bus Queues to send data to our SignalR web roles which then forward on to the clients. The CAT pages have very good examples of how to set up asynchronous loops and sending.

    0 讨论(0)
  • 2021-02-05 19:02

    Keep in mind my knowledge of this two technologies is very basic, I'm just starting. And I might have misunderstood your question, but it seems pretty obvious to me:

    Web roles are capable of subscribing to a queue server where the worker role deposits the message?. If so there would be no client "pulling", the queue service would provide the web server side code with a new message, and through SignalR you would push changes to the client without client requests involved. The communication between web and worker would remain the same (which in my opinion, it's the proper way to do it).

    0 讨论(0)
  • 2021-02-05 19:07

    If you are using the one of the SignalR scaleout backplanes you can get workers talking to connected clients via your web application.

    How to publish messages using the SignalR SqlMessageBus explains how to do this.

    It also links to a fully worked example which demonstrates one way of doing this.

    0 讨论(0)
  • 2021-02-05 19:16

    You can use your worker roles as SignalR clients, so they will send messages to the web role (which is SignalR server) and the web role in turn will forward messages to clients.

    0 讨论(0)
  • 2021-02-05 19:23

    Alternative message bus products such as NServiceBus could be worth investigating. NServiceBus has the ability to deliver messages asynchronously across process boundaries without the need for polling.

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