why deepstreamHub? compare us getting started feature roadmap faq
use cases pricing
products
developers
company
blog contact

Allows users to reconcile record versions in case of data-conflict ( out of sync record versions )

Methods

merge(record,remoteVal,remoteVer)

JsonElement merge(Record record, JsonElement remoteValue, int remoteVersion) throws RecordMergeStrategyException
argument type description
record Record Used to retrieve the local version via record.version() and data via record.get()
remoteValue int The remote value on the platform
remoteVersion int The remote version on the platform, used to find out if the remote is ahead of the local

Whenever a version conflict occurs the MergeStrategy set via Record.setMergeStrategy(strategy) will be called to merge the data and send the data back to the platform.

This is mainly used for scenarios such as when working on very collaborative records where messages cross on the wire, or for connection drops where the client still updates records in an offline mode.

Throw an error if the merge fails, but keep in mind that this only means it will postpone the merge conflict until the next remote/local update.