简体   繁体   English

如何在 spring 引导应用程序中实现 oracle db 侦听器

[英]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.我在oracle 数据库spring 启动应用程序中有一个表,我希望我的 spring 启动应用程序侦听表中发生的任何更改(更新/插入)并在此之后执行一些操作。

I have seen some stack-overflow answers that suggests to use DBMS_ALERT or Oracle AQ / Oracle Streams .我已经看到一些建议使用DBMS_ALERTOracle 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.请让我知道是否可以这样做,如果可以,我如何在 spring 启动应用程序中实现它。 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.我想理论上你可以在你的 spring 启动应用程序中创建一个check timer function来有效地检查是否有任何行被添加到表中。 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.但是,对于更新或删除的项目,您可以在表 object 上实施触发器,并有一个辅助表来跟踪这些更改,您可以再次在预定的时间间隔检查这些表,以了解 springboot 应用程序的任何更改。 You could look into spring-jdbc for examples on how to do CRUD operations.您可以查看spring-jdbc以获取有关如何执行 CRUD 操作的示例。 If you have any specifics questions post them up and we will try to help you.如果您有任何具体问题,请提出来,我们会尽力帮助您。 GOOD LUCK!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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