即使在弹簧应用程序进程外插入/更新表,是否可以从spring收听表插入或更新?
答案 0 :(得分:0)
一个建议:你需要根据你的RDBMS做一些额外的工作
- Create triggers for each of your listening tables, this trigger
should base on a new change on these table to update information to
somewhere else
- Create a table (named: datalogger)to store the data come from the trigger above, for example, when table1 has new record inserted, the
trigger (named: trigger1) on table1 will be execute by RDBMS, then
trigger1 will insert a new record into datalogger which describes
the action event is "inserted", table name is "table1", and the
inserted record id is "new_recordId" as example. The same process
need to be applied for modifying action.
- On your application, create a job, which will try to query the datalogger table periodically, (1ms, 10ms,... as your requirement)
to find is there a new record in that table, if any, read the new
record and find out what happened with your database based on the
new record (determine by time or auto-increment id,..)