0.0.4 • Published 6 years ago

sql-server-sse-bridge v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

SQL Server events with NodeJs

It's very useful to get events out of databases. Oracle has OracleDatabaseChangeNotifications and PostgreSQL has LISTEN/NOTIFY.

SQLServer seems to have good .NET support but can you do it in other languages?

Yes.

This is a nodejs version which is just calling SQL basically. It does hang a connection, I think. Not sure the connection can be used for anything other than waiting on the event.

That's ok. It's still just waiting. Not actively hammering the database.

Setting up an environment that you can test this with

You need SQL Server and some config. See this documentation.

How to send an event

Use SQLCMD with the post script:

SQLCMD -i post.sql

this also presumes a database called nicdev2.

How to test the nodejs

Run the SSE server with enough db information to start it up:

npm install
node server.js 8004 nicdev2 MyRecvQueue

where the args are: port database and queue

the password has to be in a file called .password in the current directory.

Visiting http://localhost:8004 in your brower will now open a demo webapp which subscribes to the queue-bridge and displays the JSON of the arriving events.

DB connections timeout after a minute and are automatically reestablished.

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago