Reza Abolfathi
Reza Abolfathi

Reputation: 3191

SymmetricDS sync based on last updated time

I have 2+ clients + 1 server and I'm able to keep all data synced between clients and server as long as they're all connected. but problem is when a client (laptop) is not online and gets online after a while, in this situation I need to make sure only latest data is synced across databases but now what happens is last connected client's data gets synced to other clients/server even if it's not latest changes and there are newer changes on server/other clients.

I appreciate if you can help me solve this.

Upvotes: 1

Views: 209

Answers (1)

Reza Abolfathi
Reza Abolfathi

Reputation: 3191

Finally I find the answer

I added a load filter record and used following bsh script to filter_on_update column to avoid changes with older modified date value

import java.text.SimpleDateFormat;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S", Locale.ENGLISH);
if (format.parse(MODIFIED).after(format.parse(OLD_MODIFIED))) {
            return true;
    } else {
            return false;
    }

Upvotes: 1

Related Questions