开发者

What is the recomended approach to synchronize data between different applications?

I've an application written in J2EE+S开发者_如何学编程pring+Hibernate (call it app1), now my boss wants that another application (app2, totally differente and written with different technologies), could regularly and automatically sync with it (at least just one way app1 to app2). I've never done something like this... I can think of the problem: app2 calls app1 (maybe using a webservice), how do I know what part of data has been addad and updated since last sync? What I tought is of adding a timestamp column on every table of the main app2, so that app1 can say "give me everything that is changed or added after timestamp xxxx. This involves modifying many things. What other features can I use to solve this, whitout modifying too much the structure of the application? (Suppose databases are different and I don't want to have database ports open to everybody on my server).

finally, I forgot, what about row deletion? Timestamps won't solve this...


You could maintain a log of changes in app2. A trigger for insert/update/delete could maintain this log table. App1 could read the table to get changes and delete processed log rows periodically.


Take a look at Terracotta (http://www.terracotta.org/), it's a very robust framework for synchronizing objects between machines.


You might need to look at some database synchronisation utility. That would be better, I believe.


By sync, do you mean the data accessed by app2 should be same as the data accessed by app1 (means, app2 should be able to see the latest data, as updated/modified by app1)?

If this is the case, why not just point app2 to the same database used by app1?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜