Best practices to notify clients of a data change


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.



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.



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.
Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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

No.  Remoting is really slow...so don't try to create anything that uses remoting as a base.  We actually created our own request and response objects (which you could just use HttpResponse and requests for that matter).

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?

Correct...you would have to create subscriptions, etc...this could get hairy for async traffic.

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)?

They could really be one in the same in this respect.  You can even create a service that runs as your service (this is what we do).  We just have a service (not web service) that runs as our server.  You could create a TcpIP listener and server on a port that allows traffic to flow both ways.  This is a way to create a tunnel between your server and clients and gives you total control.

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?

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.  If you are going to try this approach, you are WAY better off creating sprocs and calling scalar methods.

FWIW we have somewhere in the neighborhood of 20 threaded timers in our server and application and it hasn't slown down a thing.  This includes the deployments in the field where we have some clients running on really crappy equipment and connections as well.  So this really comes down to how you design the query.  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.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks Trent. Lots to chew on.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
No problem Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Greg McGuffey - 17 Years Ago
Peter Jones - 17 Years Ago
Edhy Rijo - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                     Thanks Trent!

It is good to know that ES doesn't support...
Greg McGuffey - 17 Years Ago
                         [quote]you mention an application server. I'm assuming this is some...
Trent L. Taylor - 17 Years Ago
                             Thanks Trent. Lots to chew on.
Greg McGuffey - 17 Years Ago
                                 No problem :)
Trent L. Taylor - 17 Years Ago
Greg McGuffey - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search