Java PHP – Best Offline Failover Methods for Desktop Clients Using Web Services

ArchitecturejavaPHPweb services

I have three incoming projects that share a common problem:

they need to have the logic on a web system and they need a local application (e.g. point of sale) that communicates with such system through a RESTful web service.

My Solution

The solution I managed to come up with is to implement in the desktop application message queuing to store operations while the service is offline, more precisely, asynchronous message queuing. However, that is the easy part (if such is the best solution). I'm also concerned with data syncing and conflict resolution.

The main system needs to be web based since a web app is required for reports and monitoring by the stakeholders, and the web services would handle requests for several establishments.

The desktop clients (preferably thin) will be implemented with Java (more specifically Netbeans) and the web system with Symfony2. Two of the projects require hardware integration for the client, so making the desktop application with web technology (e.g. Appcelerator Titanium) could be a major pain.

My Question

  1. What is a better solution that scales, meaning maximum efficiency with minimum effort (and preferably no additional costs, like buying a backup server for local operation) ?

  2. Who else has dealt with this before? How did you solve your problem? What lessons can you share?

  3. How did you deal with synchronization?

Edit: Added a missing part to my question in point #3

Best Answer

I know your question is java, but I really like this message bus style architecture for this type of thing.

Basically when messages are sent they get potentially two responses. The first is from the local cache, the second comes from the server once it gets connected.

I'm pretty sure you could adapt this architecture (rhino bus and nhib) to yours (MQ and hib) pretty easily.

Related Topic