I'm currently working on a project using hibernate for persistance on top of databases of various types. The solution consists of multiple servers with their own databases. The challenge is now to build server that receives all data from all other servers to provide monitoring and reporting functionality. If data changes in one of the servers, it shall (almost) instantly be sent to the monitoring server. Network latency and outage shall be handled.
I found two possible ways to monitor the data changes (insert, update, delete):
Hibernate Envers
Appears to be an auditing solution that builds a protocol of all modifications in individually created database tables. I could not find information how to filter the data. This may become necessary in the future
Hibernate Interceptor
The interceptor functionality (e.g. described in the Mykong blog entry). It does almost the same like Envers but gives me the possibility to use my own audit table to store the modifications and to filter the data by my own criteria if necessary
My idea is now to
- store the modifications by serializing the data to the audit table
- scan the table (e.g. every 30 seconds) for new entries
- transfer the entries (e.g. by http upload) to the monitoring server
- import the data to the monitoring database using hibernate
My question is now: Is there a better or easier way to solve this?