The Benefits of Push Notifications
Reacting to database changes the traditional way: polling
If your business requires users to be notified when a database record is inserted or updated, the traditional approach is to check or ‘poll’ the database at regular intervals to determine if a change has been made. The problem with this approach is that it’s inefficient: the database will be polled every minute, for example, even if no changes have been made within that minute, resulting in many redundant calls to the database. So, what’s the alternative?
Reacting to database changes efficiently: push notifications
In a recent bespoke software development project, our manufacturing customer requested an alerting mechanism to notify users when sufficient stock was received to enable cancellation of unfulfilled stock orders. Rather than adopt a polling mechanism, efforts were focused on delivering a mechanism that would push a notification to end-users as soon as a change was made in the database. By switching to a push notification mechanism, redundant database calls have been eliminated and end-users are now notified of events in near real-time. Technically, how was this achieved?
SQL CLR Stored Procedure + Message Queue + Windows Service = near real-time notifications
First and foremost, the push notification mechanism had to be simple, work in SQL 2012 and be compatible with software written in .NET, our customer’s chosen software framework. Guided by these parameters, and using custom software development, a solution was devised to provide SQL with a ‘hook’ into the .NET framework using a SQL CLR Stored Procedure, which is called when a database record is inserted or updated. When called, the SQL CLR Stored Procedure creates a message in a Message Queue (MSMQ) that is monitored by a .NET Windows Service, which subsequently relays the message to end-users. Voila – near real-time notification and no redundant database calls!
Other benefits of push notifications
Our manufacturing customer’s old software system allowed end-users to click a refresh button in order to view the latest data; unfortunately, such refreshes were slow and often caused the application to hang! Following the development of the push notification mechanism, requests that subsequently cause data to be refreshed automatically are relayed to end-users when required and without user-interaction or application hang.
What would a push notification mechanism do for your business?
To discuss what a push notification mechanism could do for your business, or if you have any other bespoke requirements, Symbiosys Business Solutions can help.