[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

SignalR - getting new data from sql DB

Im looking at SignalR, however i'm a little confused about how it will update based on new data

I have a sql server 2014 enterprise table called tblAssets
On this table is a column called LatestRecordId

This contains the latest ID from a table called tblAssetLogs

Currently, every 30 seconds I use long polling to get the latest asset log data.

What i want to do:
1. every time tblAssets.LatestRecordId is changed, then push the new data to the client

Does anyone know if this is possible? and how i would achieve this?

I'm using .net framework 4.5 and iis7 on windows 2008 r2
0
websss
Asked:
websss
  • 3
  • 2
1 Solution
 
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
Based on your requirement, it seems that you need transactional replication between the Assets database (article to replicate would be based on the data to be exchanged with the client) and the client database.
0
 
websssAuthor Commented:
I'm not sure what that means
But in a nutshell
When an ASSET sends new data to the server, we insert it into the LOG table, and then use the newly inserted records ID to update the ASSETS table (tblAssets.LatestRecordId)

When this ID changes, it needs to push to the client as the data needs to be refreshed on their browser

how do we do that?
0
 
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
Oh, refreshed on the browser application. I thought it was to be sent over to another database/database system. Sorry.

You can have a ROWVERSION column on your dbo.tblAssets tables. This data should be stored in your session. What you need is a process on the client side that regularly polls the database for changes by checking to see if the ROWVERSION has changed (it will automatically change when you update the data in the table), and if a change is detected, refresh the UI.

Database systems, unlike front-end applications do not have the ability to "fire" a message - they are data storage and processing areas and once processed, the requesting application has to pick up the data (like a kitchen, for example - an order comes in, it is serviced and then the banquet staff must periodically check and pick it up if the meal is ready).
0
 
websssAuthor Commented:
hmmm
this is long polling, and i do this already
Kinda outdated now
0
 
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
If you use Service Broker (available on Enterprise & Standard only), you may want to explore using Query Notifications: http://www.codeproject.com/Articles/144344/Query-Notification-using-SqlDependency-and-SqlCach
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now