Dual System DeawMGT Design and Implementation Notes

Data Transfer

Theory of Operation

Connection to narvi closed.

  1. The internal system actively contacts the shared system using a REST request:
    • Polls for updates on shared system, stored in the staging area on the shared system
    • Sends updates to the shared system
  2. The tables that are transferred are defined as site settings in the site settings file (See below)
    • The list of tables to transfer is different for each system
  3. Database selects, inserts, updates and deletes cause triggers to:
    • (do what)
  4. Anything else?

Overview Example Record Transver

Internal System to Shared System

  1. Shared system insert (or updates) a Comments record in the local database linthal114dev1
  2. An insert trigger named ? is activated, which ?
  3. ...

Shared System to Internal System

Databases and Staging Area

Databases and Configuration

Each system has two databases:

The list of tables that are transfered are defined in the SiteSettings:

Database Triggers

Explain

Staging Database

The staging area has a single table MirrorRecords:

+--------------------+---------------------+------+-----+---------+----------------+
| Field              | Type                | Null | Key | Default | Extra          |
+--------------------+---------------------+------+-----+---------+----------------+
| id                 | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| createTimestamp    | datetime            | NO   |     | NULL    |                |
| processStatus      | int(11)             | NO   | MUL | NULL    |                |
| statusTimestamp    | datetime            | NO   |     | NULL    |                |
| tableName          | varchar(64)         | NO   |     | NULL    |                |
| operation          | char(1)             | NO   |     | NULL    |                |
| keyWhere           | varchar(255)        | NO   |     | NULL    |                |
| phpSerializeRecord | text                | YES  |     | NULL    |                |
+--------------------+---------------------+------+-----+---------+----------------+

Main Classes

Set the debug flag in these classes to see what is happening:

Rest Requests

Mirroring Transactions

The following is a list of the REST URLs and what they are used for:

Authorization of Restransactions

Configuration Issues

Software Packaged

The following packages are required (in addition to normal DrawMGT)?

Settings

Set URL of partner system:

Testing Issues

Show Next Record PHP Script

For displaying the next record to be processed. Calls the getnext REST transaction.

Run on the internal(?) system (can you run it on the shared system?)

Sets a read status flag (fieldname?) in the staging database, but this doesn' matter (causes a warning?)?

<?php
  function splitMirrorRecord() {
  }

  $r = new HttpRequest('http://narvi.softxs.ch/dev/linthal114dev2/mirror/getnext', HttpRequest::METH_GET);
  // $r->addQueryData(array('category' => 3));
  try {
    $r->send();
    if ($r->getResponseCode() == 200) {
      $content = $r->getResponseBody();
      print "content:$content\n";
      $record = unserialize($content);
      var_export( $record );
      $dbrecord = unserialize($record['phpSerializeRecord']);
      var_export( $dbrecord );
    } else {
      print( "response code: " . $r->getResponseCode() . "\n" );
    }
  } catch (HttpException $ex) {
    echo $ex;
  }
?>
Copyright 2008-2014, SoftXS GmbH, Switzerland