SQL Server Service Broker client for Node.js
const Sqlssb = require('sqlssb')
const service1 = new Sqlssb({
user: 'sa',
password: '<PASSOWRD>',
server: 'localhost',
database: 'sqlssbb',
service: 'sqlssb-demo-sample-service',
queue: 'sqlssb-demo-sample-queue'
})
service1.on('sqlssb-demo-message-type', ctx => {
console.log(ctx.conversationId);
console.log(ctx.messageBody);
console.log(ctx.messageTypeName);
console.log(ctx.messageSequenceNumber);
console.log(ctx.serviceName);
})
service1.start({ //default settings:
timeout: 5000, //5 seconds
count: 1 //one message at a time
})
See demo folder for more examples.
To setup / reset demo stuff:
sqlcmd -S localhost -U sa -P Sqlssb01 -i demo/reset.sql
Tests:
npm test