Open
Description
- What versions are you using?
"node-oracledb": "^1.0.2",
"oracledb": "^6.3.0",
"@nestjs/typeorm": "^10.0.2",
- Describe the problem
I'm encountering an issue with subscribing to Oracle table changes using Nest.js. When another Java-based service updates Oracle tables, the changes are not being detected by my subscription mechanism. A dditionally, in my local testing environment, using a visual tool to directly modify the tables, only the first change triggers the subscription event. Subsequent changes do not trigger the event unless I completely close the visual tool and reopen it before making another update.
- Include a runnable Node.js script that shows the problem.
async onModuleInit() {
try {
const { username, password, host, port, serviceName, database, connectString } = config;
oracledb.initOracleClient();
this.oracleConnection = await oracledb.getConnection({
user: username,
password,
connectString,
events: true,
});
async function handleTableChanges(message) {
console.log('Table changes:', message.tables);
}
const options = {
sql: `SELECT * FROM ${database}.LIM_TABLE`,
callback: handleTableChanges,
clientInitiated: false,
};
console.log('Subscribing oracle options: ', options);
await this.oracleConnection.subscribe(
'lims_changes',
options,
);
} catch (error) {
this.logger.error(error);
}
}