Felipi Estevão
Felipi Estevão

Reputation: 9

Sequelize | notify my application when an insert occurs in a specific SQL Server table

I'm working on an API that sends messages contained in a SQL Server database. The problem is that I implemented it in a way that every 10 seconds the API performs a query for messages not yet sent. I would like to optimize this by making the SQL Server warn every time my table receives an insert, so that the application can query the messages to be sent. For that I'm using node JS and importing Sequelize. I also think it's important to comment that the inserts of this table are made by another application.

Upvotes: 0

Views: 169

Answers (1)

O. Jones
O. Jones

Reputation: 108776

If your infrastructure has a message broker set up (it probably doesn't, but ask your operations crew) you can use an event notification for this.

Otherwise you're stuck polling your server, as you described in your question. That is a workable strategy, but it's worth hard work to make sure the polling query is very efficient.

Upvotes: 1

Related Questions