简体   繁体   中英

How to implement a oracle db listener in spring boot application

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM