I have developed a billing application using grails3. Requirement is to use this application both online and offline, when internet facility interrupted, While using offline data is being stored in local Mysql db and when I switch to online, the offline Mysql data should be updated to my remote Mysql db. What is the best strategy to implement this use-case. Is there any grails-plugin available for this scenario.
One of my friends suggested the following use-cases to consider:
If you assume the amount of time the system is going to be offline is fairly low, you can hold the data in-memory and push when the system is back online.
If you think the data can get large with offline storage, you can use a FLAT File to store your data and then read that file and do the writes in your remote mysql db.
You can also use mysql replication capabilities to replicate your data and have both local and remote mysql instances. You will have to invest some time on how to do this.
Use a message queue mechanism to queue your queries when offline and then write to remote db in same sequence when online.
Use a in-memory or local h2 database If your sql queries are not too complex. Write a job that periodically writes to your remote instance.