简体   繁体   中英

Best way to transfer data between two Java web applications running on different servers

I have the following scenario:
There are clients which store data in their local databases and a server which timely request this data and stores to server's local database. So what is the best way to copy data to the server ?

I am using Java (JSP, Servlet) on both sides.
Thanks in advance.

Your approach should identify which systems are independent and should not "know" about the other systems.

With that in mind if the clients are web applications accessible by the server you should publish web services from the client web applications, for the server to consume/call.

If the clients are web apps not accessible by the server or are desktop clients, then you should publish web services on the server and create a separate component/application at the client side to poll for changes on your clients either via web services, if web apps, or direct access to database. Afterwards that component should consume/call the web services of your server to give the data to that system.

Expose a web service and ask clients to push their local data to the web service. You can select either XML based web service or Jason based web service . I prefer XML based web services if the amount of data to be transmit is less.

I prefer to use any data replicator services in both server and client side. For an example, can use SymmetricDS (Open source available) to replicate data between client and server database. Also we can configure the sync interval and route the data in channels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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