First post here on Software Engineering, so I hope I don't goof up too much.

I am writing software that integrates with an application written by a company that has a small development team. I have suggested that they add webhooks to their application so that it can be event driven. They have said that they like the idea but it just isn't in the cards for the time being.

Currently I have to continuously call their web service to pick up any new entities that have been created. This works ok, but the more entities that are in the system, the long it takes for me to register that there has been a new one created.

I have decided to try and create these webhooks myself through the use of SqlDependency. My current plan is to create a windows service that will monitor the database for specific changes and then send the newly created entity's ID to any of the URLs that have been specified in a json file.

My question is can this be done?

What are the drawbacks of using SqlDependency? Are there better ways to achieve this?

  • So wait. You want WebHooks so you can see when a new entity was created but also have direct access to their database? – MindSwipe Oct 18 '19 at 5:49
  • @MindSwipe Yes. Just having access to something doesn’t make it event driven. – JohZant Oct 18 '19 at 6:05
  • I am aware of that. But your request for WebHooks made it seem like you are using some web technologies, a web API for example. And when using web technologies, having direct access to the database is fishy at best – MindSwipe Oct 18 '19 at 6:07
  • @MindSwipe Yeah, it is all using web technologies. I would rather not have to look at the database, but since they are not planning on adding webhooks anytime in the future, I am just wondering how I could go about implementing my own. I have access to their web server and their connection string. – JohZant Oct 20 '19 at 22:42
  • Hmm ok, there are several ways of doing it, an SQL Dependency would work, if you can create a Query that executes fast and gets you the most recently created. But personally I'd look into Transact-SQL Triggers with them you can do something when a record either gets created, updated or deleted and then somehow hooking it up to a SqlDependency (Stored procedure maybe) – MindSwipe Oct 21 '19 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.