How to implement a oracle db listener in spring boot application

Viewed 224

I have a table in oracle database and a spring boot application, I want my spring boot application to listen to any change(update/insert) that happens in the table and do some operations after that.

I have seen some stack-overflow answers that suggests to use DBMS_ALERT or Oracle AQ / Oracle Streams.

Please let me know if it is possible to do that, If yes How can I implement it in spring boot application. Please suggest if there is any other way to achieve that.

1 Answers

I suppose theoretically you could create a check timer function in your spring boot application that would effectively check if any rows have been added to a table. That would take care of new rows. However for items that are updated or deleted , you could implement a trigger on the table object and have a secondary table which would keep track of those changes and again you could check those table on pre-determined time interval for any changes from springboot application. You could look into spring-jdbc for examples on how to do CRUD operations. If you have any specifics questions post them up and we will try to help you. GOOD LUCK!

Related