oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

When another Java-based service updates Oracle tables, the changes are not being detected by my subscription mechanism. #1672

Open siisiooy opened 1 month ago

siisiooy commented 1 month ago
  1. What versions are you using?

    "node-oracledb": "^1.0.2",
    "oracledb": "^6.3.0",
    "@nestjs/typeorm": "^10.0.2",
  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.

  1. 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);
    }
  }
sharadraju commented 1 month ago

Hi @siisiooy Thanks for using node-oracledb. We will look into this.