Conflict Management
  • 13 Dec 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Conflict Management

  • Dark
    Light
  • PDF

Article summary

While using Offline Apps, conflicts may occur when updating the EdgeReady Database. The EdgeReady platform by default provides an inbuilt mechanism to handle data conflicts. It involves using the following blocks in Integration Builder during implementation:

  • Generate Hashcode
  • Update with Check

The conflicts raised are displayed in the Console tab of the EdgeReady platform. The platform administrator can take the appropriate steps for resolution. Refer Steps to Resolve Conflicts section for more information.

Implementing the Conflict Resolution Logic

Use case: Two users download an Offline app to their device. User-1 updates a record in Table A. The updates are sent to the server. If user-2 also updates the same record in Table A before the new server download, a conflict has occurred.

To generate such conflicts in the Console > Conflict tab, the developer should implement the logic in the following sequence:

Pre-requisites

  • Create DB table in the EdgeReady Database (also called Server data).
  • Create corresponding table variables(Business Function variables) in App Process Modeler(APM) (also called Transaction Data)

A. Setting up the Digest column

  1.  Add a Digest column(Text) to the EdgeReady Database table.
  2. Add a Digest column(string) to the table variable.

B. Setting Up the Insert BOS

  1. Use Generate Hashcode block(in Integration Builder) and add all editable columns as its parameters.
  2. Insert the generated hashcode values of the record to the digest column of the corresponding record in the EdgeReady Database table.

C. Setting Up the Update BOS

  1. Use the Update with Check block to update the new values successfully or trigger a conflict.
  2. Store the response in a local variable (Number). The status of the update is denoted by: 0= Success, 1=Failure. 
  3.  If response=1, a conflict has occurred and the data is automatically moved to Console > Conflicts log. This BOS can be terminated if desired. The end user can see such terminated BOSes in the error queue of the container app.
  4. If conflict has not occurred(response=0), then update the new hashcode value to the digest column of the table variable.

Sample Implementation

Note
The following Contacts App use case is restricted to describing about "Managing a conflict scenario". It does not include details of any other functionalities of the Contacts App.

For an Offline Contacts App, a Create Contact (Name, Address, Phone) and Update Contact screens are available. If two users update any value(Address and/or Phone) in the Contacts table simultaneously, a conflict has occurred. The following implementation guides the developer to design a conflict resolution logic for the Contacts App.

BOS - Insert Contact

In the Insert BOS, use a Generate Hashcode block that generates a hashcode for the Address and Phone columns. The  hashcodes are sent to the employeeDetails table( EdgeReady Database table) and then added to the Contacts table variable.

EdgeReady Database TableContacts Table Variable
ERDBnew-1Tablevariable-new-1
Sample BOS - Compute Hashcode and write Insert Statement
SampleImplementation-AddContacts

BOS - Update Contact

In the Update BOS, add an Update with Check block and select the Hash value. The status of the Update is returned to the 'result' variable added to the 'To' field. For every update, a new hash code is automatically generated by the Update with Check block.

Sample BOS - Update with Check and Update Contact Logic
UpdateContact-new

The status of the update is denoted by: 0= Success, 1=Failure. If 1, then the data is automatically moved to Console > Conflicts log to be resolved by the admin.

Note
The EdgeReady platform does not provide any prebuilt conflict resolution methods to handle Insert or Delete conflicts.





Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence