We have an MVC5 application that is using using SingalR. The app is currently behind load balancer and we have a garden of servers. So, we are using the scaleout mechanism via SQL server backplane to make sure all nodes get the same notification. It is working well.
In the meantime, we have some operations that we are executing externally that would need to send a message to our servers. The operations are happening inside SQL server. So, I am thinking to have some kind of timer that keeps monitoring a table and when a certain condition occurs, it would broadcast the message. This can work but the timer need to occur on web apps and keeps pinging the db to check.
It feels wrong. Is there an alternative to that?
The SQL backplane is a black box. It would be great to write a record there and let SignalR carry it over..
Thanks,
I did something similar but the timer is inside of SignalR Handler that checks the database for specific data based on what clients are connected to the Hub of this handler. The data from the database is then sent to the clients over SignalR with the backplane being handled internally by SignalR.
Alternative solutions would depend on your specific implementation. I guess you could try a trigger instead of a timer to write into the SignalR message tables but this is dangerous. Another possibility would be an SQL Agent to run on a timer and trigger some program or script.
From SignalR documentation: