4
votes

I have 2 roles in my Azure cloud service application: a web role (signalr connections here) and a worker role.

The web role uses Azure service bus as its scaleout provider.

At certain points in time the worker role will emit certain events. I'd like to send this data directly to clients connected to a Hub.

My current implementation involves the worker role placing a message on a service bus queue which the web role subscribes to, the web role then forwards this message to clients via a HubContext call.

My question is: how can I send this message directly to connected clients from the worker role? So far I have considered 3 methods:

  • Configure signalr as in the web role so that they use the same servicebus topic. - this done not work as intended as worker role instances "steal messages" from topic subscriptions intended for the web role. This would seem to be the cleanest way of doing it but configuration is a problem.

  • Use the .Net client to send a hub message - this is not ideal as it places unnecessary load on the web role, as well as double the amount of service bus messages when compared to the above method.

  • Manually write a signalr compatible message to the topic - very hacky and succeptable to breaking changes.

I know that the team are currently rewriting scaleout for the next release but will this be possible at some point?

Edit: I have noticed that this is supported in the RabbitMq implementation.

1

1 Answers

1
votes

It seems an issue with my configuration was responsible for the first method not working. However, it seems like that method is slower end to end (by about 150 ms) even with one less message in the loop.

I will wait and see if the scaleout work brings any improvements to this method before making any changes.