Oracle JDBC: renewing database change notification registration

I look at the Oracle DBCN API (Continuous Request Notification) and, using it, implements an event stream indicating new and / or changed rows in the database.

What bothers me is: if I configure and start the change listener, and then my java client crashes, the server side is still accumulating changes for delivery. However, when my java client resumes, my options seem to be limited:

  • Start a new registration. I do not want to do this because it will only start a new registration (with the old one, still running “without a client”), and my new registration will not be sent for the previous registration.
  • I can query the table USER_CHANGE_NOTIFICATION_REGS , find the previous registration and cancel it, but it still does not give me my backlog of undeliverable notifications.

So how can I resume a session with an existing registration? Alternatively, where can I find and receive forgotten notifications?

Thanks.

// Nikolay

+4
source share
1 answer

You can implement a server-side solution (PL / SQL) that will queue all changes (Oracle Advanced Queue). Then your java client can connect to this queue and get the changes.

If your client fails, the changes will still be written to the queue on the server. And when you resume work with the client, he will receive all the changes from the queue, resuming them from the last received by you.

+2
source

Source: https://habr.com/ru/post/1402673/


All Articles