Mysql monitoring for changes

I have a Java application using a MySQL database through sleep mode. The database is really used as a persistence level: the database is read when the program is loaded, and the records are stored in memory.

However, we add extra complexity when another process can also modify the database, and it would be nice if the changes affected the Java application. However, I do not particularly like the mechanisms for moving queries to the database every few seconds, especially because the database is rarely updated.

Is there a way to get a callback to listen for changes to the database? Would triggers help?

+3
source share
5 answers

Or modify both applications so that the Java application truly owns the MySQL database and provides it as a service. You link two applications at the database level, doing what you offer.

If you have one data owner, you can hide schema changes, etc. behind the service interface. You can also create a publish / subscribe mechanism to notify stakeholders of database changes. If these things are important to you, I would reconsider the possibility of using another application directly from MySQL.

+5
source

Another way would be to use the compiled MySQL server itself with the patches from this project

ProjectPage External Language Stored Procedures

Java MySQL

+2

? ?

, , , . question SO.

, Java- ( webapp), .

+2

- ( ) , . , .

"last_updated" ( mysql) . .

0

, Java, , memcached Ehcache. ( ) , memcached.

, , - , , .

0

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


All Articles