﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » Best practices to notify clients of a data change</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:38:46 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16818.aspx</link><description>No problem :)</description><pubDate>Tue, 03 Jun 2008 21:59:39 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16780.aspx</link><description>I'm going to need to be able to have my app be aware of data changes to a table. Specifically, the app is sensitive to changes in state of "projects". (My app is used by consultants who work on projects.)  If a project manager updates the project table, any current users need to be informed of this. More specifically, any apps that are logged into that project need to be notified so they can update UIs, apply new business rules, etc. &lt;br&gt;
&lt;br&gt;
Currently we are using a low tech solution...the project managers are trained to communicate with their team, get everybody out of the project, then make the change.  This is an infrequent task, so it works OK.&lt;br&gt;
&lt;br&gt;
Currently, we are on SQL 2000, but we'll be moving to SQL 2005 soon (that's the plan in any case).  So, the question is what is the best/scalable/least hit on client performance to implement this?  Are SQL 2005 notification services a good idea?  The only other thought I've had is a timer in each client to run a query to check for changes...but that seems like a bad idea as this occurs rarely (the changes just have HUGE ramifications) and most of the clients are connecting remotely.</description><pubDate>Tue, 03 Jun 2008 21:59:39 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16813.aspx</link><description>Thanks Trent. Lots to chew on.</description><pubDate>Tue, 03 Jun 2008 17:27:49 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16812.aspx</link><description>[quote]you mention an application server. I'm assuming this is some sort of server based component. Does it use remoting? Can remoting be used to raise events [/quote]&lt;/P&gt;&lt;P&gt;No.&amp;nbsp; Remoting is really slow...so don't try to create anything that uses remoting as a base.&amp;nbsp; We actually created our own request and response objects (which you could just use HttpResponse and requests for that matter).&lt;/P&gt;&lt;P&gt;[quote]I suppose something like a web service could also be used, but as far as I know, they don't raise events. Could a web service be used?[/quote]&lt;/P&gt;&lt;P&gt;Correct...you would have to create subscriptions, etc...this could get hairy for async traffic.&lt;/P&gt;&lt;P&gt;[quote]If I end up having to use the polling method, via a threaded timer, what is likely faster: scalar method, call to a web service, call to an application server (whatever that means)?&lt;BR&gt;[/quote]&lt;/P&gt;&lt;P&gt;They could really be one in the same in this respect.&amp;nbsp; You can even create a service that runs as your service (this is what we do).&amp;nbsp; We just have a service (not web service) that runs as our server.&amp;nbsp; You could create a TcpIP listener and server on a port that allows traffic to flow both ways.&amp;nbsp; This is a way to create a tunnel between your server and clients and gives you total control.&lt;/P&gt;&lt;P&gt;[quote]I was thinking about using a "notification" table. I.e. if an action/data change occurs that results in any clients needing to be updated, a new record is written to this table, which would "trigger" or raise an event that is broadcast to clients (although I don't see how to do this at the moment) or it would be this table that clients would poll via the threaded timer using a scalar method (either a query or a sproc that would check the table) or this table that the web service/application server would query. Do you seen any problems with this?&lt;BR&gt;[/quote]&lt;/P&gt;&lt;P&gt;This type of approach generally presents a lot of issues...applications may die, power go out, etc. and then you have "junk" and orphan records lying around.&amp;nbsp; If you are going to try this approach, you are WAY better off creating sprocs and calling scalar methods.&lt;/P&gt;&lt;P&gt;FWIW we have somewhere in the neighborhood of 20 threaded timers in our server and application and it hasn't slown down a thing.&amp;nbsp; This includes the deployments in the field where we have some clients running on really crappy equipment and connections as well.&amp;nbsp; So this really comes down to how you design the query.&amp;nbsp; If you are calling a sproc on the SQL Server, the scalar method isn't going to choke anything down...it should be really fast, especially if you are polling on a 30+ second interval.</description><pubDate>Tue, 03 Jun 2008 16:29:54 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16810.aspx</link><description>Thanks Trent!&lt;br&gt;
&lt;br&gt;
It is good to know that ES doesn't support query notifications.   Since most of my users are remote using ES, query notifications are pretty much shot.  :(&lt;br&gt;
&lt;br&gt;
I'm really leery of using a timer at the client as I'm fighting the performance vs. getting the info in a timely enough manner to be useful.  Some users will be on slow connections, where I'd really have to be careful about the timing.  &lt;br&gt;
&lt;br&gt;
For this reason, I'd really like the clients to just be notified when there is a change, at which point the client can just go get the info.  Not that I have any clear idea of how this might be done. Your reply suggests some ideas:&lt;br&gt;
- you mention an application server.  I'm assuming this is some sort of server based component. Does it use remoting? Can remoting be used to raise events between computers? (&gt;clueless about remoting :blink: )  Also, what sort of access do you need to an application server?  Virtually none of the user are inside of the internal network while using the app.&lt;br&gt;
- I suppose something like a web service could also be used, but as far as I know, they don't raise events. Could a web service be used?&lt;br&gt;
- If I end up having to use the polling method, via a threaded timer, what is likely faster: scalar method,  call to a web service, call to an application server (whatever that means)?&lt;br&gt;
- I was thinking about using a "notification" table. I.e. if an action/data change occurs that results in any clients needing to be updated, a new record is written to this table, which would "trigger" or raise an event that is broadcast to clients (although I don't see how to do this at the moment) or it would be this table that clients would poll via the threaded timer  using a scalar method (either a query or a sproc that would check the table) or this table that the web service/application server would query.  Do you seen any problems with this?&lt;br&gt;
&lt;br&gt;
Thanks for your thoughts!</description><pubDate>Tue, 03 Jun 2008 16:02:12 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16809.aspx</link><description>[quote][b]Peter Jones (06/02/2008)[/b][hr]Not that I've ever done this but what about using a trigger on the table then e-mailing the updates (directly out of SQL) to a distribution list. You can, I believe, also send SMS messages.[/quote]&lt;br&gt;
&lt;br&gt;
Thanks for the idea, Peter. Unfortunately this isn't what I'm looking for.  I don't really need to contact the [i]users[/i], but rather the user's [i]application[/i].  I'll just let the project manager contact the users.  &lt;br&gt;
&lt;br&gt;
I believe Trent's reply is more of what I'm after...&lt;br&gt;
&lt;br&gt;
Thanks for the ideas though! :D</description><pubDate>Tue, 03 Jun 2008 15:38:14 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16797.aspx</link><description>[quote]Are SQL 2005 notification services a good idea?[/quote]&lt;/P&gt;&lt;P&gt;When we first played with notification services I was quite excited and thought that this would be a great solution for a lot of things...but there are a number of potential issues that come with using notification services.&amp;nbsp; The first is, you must have a direct connection to the server (i.e. ES will not support notification services, at least for the moment).&amp;nbsp; Secondly, you have to create a subscription for each query...so if you were to use this throughout the system as a blanket solution, then it could get "sticky."&amp;nbsp; &lt;/P&gt;&lt;P&gt;Let me give you a couple of ideas on how to address this.&amp;nbsp; The way we get around a lot of this is through our application server...which I would suspect that most of the applications that get created will not have this, but you can still use the same techniques that we did, just through the client side.&lt;/P&gt;&lt;P&gt;Let's take our Appointment Scheduling software.&amp;nbsp; In this case, we have a number of front desk people who may be booking and posting appointments.&amp;nbsp; Additionally, if patients are checking in from more than one location, the "signed-in" displays need to be updated, even if it didn't happen from the computer that I am on.&amp;nbsp; So we create threaded timers.&amp;nbsp; These have an incredibly small footprint and are asynchronous (you will want to do this versus using the component timer).&amp;nbsp; To create a timer it would look like this:&lt;/P&gt;&lt;P&gt;[codesnippet]Private _MyTimer As New System.Threading.Timer(Addressof MyCallbackMethod, Nothing, System.Threading.Timeout.Infinite, 1000)[/codesnippet]&lt;/P&gt;&lt;P&gt;The above declaration would call the method MyCallbackMethod every 1 second...clearly this would be too often for performing some type of scalar method, but you get the idea.&amp;nbsp; The MyCallbackMethod would look like this:&lt;/P&gt;&lt;P&gt;[codesnippet]Private Sub MyCallbackMethod(Byval state as Object)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Perform your logic here&lt;BR&gt;End Sub[/codesnippet]&lt;/P&gt;&lt;P&gt;OK...so once you get this setup and working the way that you like in regards to the timer, then you can begin to test on a state or count, etc.&amp;nbsp; You could also create a sproc that you call that performs a fair bit of logic if it is required and returns a single value telling you if something has changed and requires an update.&amp;nbsp; We have been doing this for a while and it works really well and with very little overhead.</description><pubDate>Tue, 03 Jun 2008 09:24:37 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16786.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;Sorry I don't have anything to offer as a solution, but I am also intered in the replies since I do have the need to handle this kind of auto-update feature.&amp;nbsp; &lt;/P&gt;&lt;P&gt;And one of the situation is when sending an update out to a multi-user location, that update should check the database to see if it needs to be updated and then update all clients as well.&lt;/P&gt;&lt;P&gt;On my VFP projects I have logic in place using StoneField Toolkit to update the metadata and used the .EXE version to keep track of those updates.</description><pubDate>Mon, 02 Jun 2008 20:43:25 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Best practices to notify clients of a data change</title><link>http://forum.strataframe.net/FindPost16781.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;Not that I've ever done this but what about using a trigger on the table then e-mailing the updates (directly out of SQL) to a distribution list. You can, I believe, also send SMS messages.&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Mon, 02 Jun 2008 15:54:26 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>