Issue
DB Team inserts new data into a table. If new data is inserted I do need to send messages.
Is there any way I could track new data using Nodejs. There is no specific duration for data insertion.
Solution
If your DB is remoteDB then you do require full-duplex connection.
After getting successful connections from the telnet from both servers do as follows:
const connection = await oracledb.getConnection({
user : user,
password : password,
connectString : connectString,
events : true
});
function myCallback(message) {
console.log('CQN Triggered');
}
const options = {
callback: myCallback, // method called by notifications
sql: `SELECT ID FROM table where STATUS= 0`, // query
timeout: 600,
qos : oracledb.SUBSCR_QOS_ROWIDS, // SUBSCR_QOS_QUERY: generate notifications when new rows with STATUS= 0 are found
clientInitiated : true //By Default it's false.
};
await connection.subscribe('mysub', options);
Answered By - Shihab Abrar Hossain Answer Checked By - Willingham (sql.easybugfix Volunteer)
Post a Comment
Post a Comment