Kony Fabric
The server has following tasks:
The client side library has the following tasks:
During offline operation, the mobile application on the device is completely disconnected from the sync. Instances of the same application that may run on other mobile devices at the same time, either connected to or disconnected from the sync. Data stored locally on the mobile device running in offline mode may be modified or deleted or new data may be created. Potentially, the same data entity may be modified by multiple mobile clients concurrently, running either in online or offline operation, with potential effects on the server data store. These modifications that may be in conflict with others, have to be synchronized with the data on the server when a mobile application switches back to online operation. During this process, conflicts need to be reconciled and updates have to be made available to other application clients connected.
To enable the above synchronization needs the server may choose to store the data before merging it with the Enterprise Datasource. Though this is not a mandatory requirement, it is very desirable when the Enterprise Datasource has not been designed for handling additional mobile users or is only occasionally available.
Kony Fabric Sync provides two flexible sync strategies that help the application developer design the application that best suites the enterprise needs.
In this strategy whenever the mobile application invokes sync API, the Sync immediately merges upload packets with the enterprise server. Similarly the sync queries the enterprise server for "delta" changes real-time and sends the same to the mobile application.
In this strategy, Enterprise Datasource is assumed to be available when the device starts the sync session.
In this strategy the application data is first persisted on Kony Fabric Sync and later merged with the Enterprise Datasource as part of the offline process. Though this results in some data latency but ensures that the system is still functional even though the Enterprise Datasource may not be available.
In this strategy, the Kony Fabric Sync buffers / persists the backend data; during synchronization of a mobile client, the delta for that client is calculated based on the existing data in the sync. You can schedule replication jobs to occur at predetermined intervals to update the sync data. These jobs compare backend data with the data that is persisted in the sync and decide whether an object needs to be updated.
Deciding upon to use a Sync Strategy is one of the key architectural / designs decisions that you need to make when developing any enterprise grade offline application. This is not a simple decision but is based on number of input parameters and system constraints. Below are some of the recommendations that can help you determine to choose the appropriate strategy:
OTASync Strategy is recommended solution when:
Persistent Sync is recommended solution when:
What are the prerequisites for OTASync strategy ?
In order to select the OTASync strategy for a particular SyncScope, ensure that the follow prerequisites are met:
What are the prerequisites for PersistentSync strategy?
Applications requiring data synchronization capabilities require that changes are tracked in the server database so that these changes can be delivered to clients during a subsequent synchronization session (and vice versa). Below, we discuss different strategies that you can apply / configure to ensure that you can share only incremental updates between client and server.
Kony Fabric Sync provides the ability to either utilize change tracking that the datasource provides or in absence of such capability at the datasource, the Kony Fabric Sync itself can change tracking in the server.
During the synchronization two data stores (local device client and enterprise server), conflicts may occur if the same data object is modified independently in both participating stores. You can detect the conflicts by comparing state information of the two objects. The resolution of a conflict is called reconciliation and is always performed on the enterprise schema.
Conflict detection happens on "hashsum” generated for every row at sync server during downloads.
When a row is modified at the device, the device sends the same “hashsum” along with the content in the modified row during synchronization.
Sync server will fetch the row from backend with the PK (Primary Key) and regenerates the “hashsum”.
If both the “hashsum” values are different, then the backend data is modified by some other source. Sync server treats this as conflict and applies the appropriate conflict mechanism.
The existing conflict resolution policies are:
Note: The (hard) delete action on the server and client side is ignored (by not considering it a conflict) and no action is performed.
The following table lists all possible scenarios that can arise with the above supported conflict policies.
| Client | Server | Conflict type detected | Policy | Action on Data source | Result returned to client-side |
|---|---|---|---|---|---|
|
Insert (only for non-auto generated Primary key) |
Record already exists | Client insert server exists | Client wins | Update with client-side record (Insert converted to update as there is a conflict) | Update event with client-side record |
| Server wins | Dummy update | Update event with server-side record | |||
| Update |
Delete (soft delete) Soft delete means the record is marked as delete but the record exists in the database. |
Client update Server delete | Client wins | Update with client-side record | Update event with client-side record |
| Update | Client update Server update | Client wins | Update from client-side | Update event with client-side record | |
| Server wins | Dummy update | Update event with server-side record | |||
| Delete (soft delete) | Client update Server delete | Client wins | Update from client-side (Update converted to Insert) | Update event with client-side record | |
| Server wins | No action | Delete event with client-side record | |||
| Delete | Update | Client delete Server update | Client wins | Delete is performed | Delete event will be sent |
| Server wins | Dummy update | Update event with server-side record |
|
Copyright © 2012 Kony, Inc. All rights reserved. |