Login

Recover Your Password

Return to Product Support > Learning Center > Managing Add-ons > Add-on List and Instructions for Use > Remote Data Synchonization

Remote Data Synchonization

The Remote Data Synchronization (RDS) Add-on is used to synchronize data between two different websites. It has two components, the requester and the responder.

The RDS Requester is a process add-on that executes on a schedule and follows a set of instructions located in the RDS Setup page. These instructions can run database commands locally, or request data from a remote data source and store it locally.

The RDS Responder is a remote method add-on that responds to requests from remote systems. The instructions describing how it responds are stored in a content table called RDS Response Tasks.

In many cases, a site would only use one of the two components. It would communicate with a remote datasource, perhaps with another Contensive website using the other component.

SyncContent  Example

SyncContent would be used to synchonize two Contensive sites. In this example, we will synchronize the organization tables. System A would be considered the source of the data, or the Authoritative data source. System B needs to synchronize it's data with that of System A.

System A will be the Responder. When data is requested from it, it responds with an XML data stream. System B would be the Requester.Periodically, it requests data from the responder, and saves the data to it's tables.

The first step would be to install the Remote Data Synchronization components on both systems using the Add-on Manager.

Next, go to the Responder, System A. We will create a responder task so when requested, System A will respond with an xml stream containing the authoritative data needed by System B. On the Navigator, Open Manage Add-ons > Remote Data Synchronization > RDS Response Tasks. Create a new task called GetOrg, and paste these instructions:

<Task>
  <SyncContent>
     <Name>Organizations</Name>
     <SQLCriteria></SQLCriteria>
     <PageSize>10</PageSize>
     <RowAlias>Row</RowAlias>
     <Field>
       <Name>Name</Name>
     </Field>
     <Field>
       <Name>Phone</Name>
     </Field>
     <Field>
      <Name>Web</Name>
    </Field>
   </SyncContent>
 </Task>

Next, go to the requester, system B. Here we will create a scheduled event that periodically requests data from system A, and stores the data received. On the Navigator, Open Manager Add-ons > Remote Data Synchronization > RDS Request Tasks. Add a new record, set it enabled and paste in these instructions:

<Task>
     <SyncContent>
         <URL>http://beta.contensive.com/RDSResponder?task=getorg</URL>
         <Name>Organizations</Name>
         <Key>name</Key>
         <RowAlias>Row</RowAlias>
         <Field>
             <Name>AuthorizativeID</Name>
             <Alias>ID</Type>
         </Field>
     <Field>
       <Name>Name</Name>
    </Field>
     <Field>
       <Name>Phone</Name>
      </Field>
     <Field>
      <Name>Web</Name>
    </Field>
  </SyncContent>
</Task>

Change the domain of the URL to be the URL of system A. Now on the same setup page, check the task enabled, and set the interval for 0. This forces the task to execute every minute. You can now wait a minute, and system b will request data from system a. System A will respond with an XML stream, which system B then updates it's data with the stream.

SyncTable  Example

SyncTable would be used if you were synchonizing a Contensive site to a non-Contensive remote data source. In that case, either the requester or the responder would be the Contensive RDS add-on, and the other end would be the RDS-ODBC stand-alone server. To keep this example simple, lets just consider two websites that need to synchronize their member email lists. System A would be considered the source of the data, or the Authoritative data source. System B needs to synchronize it's data with that of System A.

System A will be the Responder. When data is requested from it, it responds with an XML data stream. System B would be the Requester. Periodically, it requests data from the responder, and saves the data to it's tables.

The first step would be to install the Remote Data Synchronization components on both systems using the Add-on Manager.

Next, go to the Responder, System A. We will create a responder task so when requested, System A will respond with an xml stream containing the authoritative data needed by System B. On the Navigator, Open Manage Add-ons > Remote Data Synchronization > RDS Response Tasks. Create a new task called Getpeople, and paste these instructions:

<Task>
  <SyncTable>
     <SQL>SELECT * FROM ccMembers where name&lt;&gt;'guest' and email is not null</SQL>
     <PageSize>10</PageSize>
     <RowAlias>Row</RowAlias>
     <Field>
       <Name>Name</Name>
       <Type>Text</Type>
     </Field>
     <Field>
       <Name>FirstName</Name>
       <Type>Text</Type>
     </Field>
     <Field>
      <Name>LastName</Name>
      <Type>Text</Type>
    </Field>
    <Field>
      <Name>Email</Name>
      <Type>Text</Type>
    </Field>
   </SyncTable>
 </Task>

Next, go to the requester, system B. Here we will create a scheduled event that periodically requests data from system A, and stores the data received. On the Navigator, Open Manager Add-ons > Remote Data Synchronization > RDS Request Tasks. Add a new record, set it enabled and paste in these instructions:

<Task>
     <Name>Get People From Remote Source</Name>
     <SyncTable>
         <URL>http://beta.contensive.com/RDSResponder?task=getpeople</URL>
         <Name>ccMembers</Name>
         <Key>email</Key>
         <RowAlias>Row</RowAlias>
         <Field>
             <Name>name</Name>
             <Type>Text</Type>
         </Field>
         <Field>
             <Name>firstname</Name>
             <Type>Text</Type>
         </Field>
         <Field>
             <Name>lastname</Name>
             <Type>Text</Type>
         </Field>
         <Field>
             <Name>email</Name>
             <Type>Text</Type>
         </Field>
     </SyncTable>
 </Task>

Change the domain of the URL to be the URL of system A. Now on the same setup page, check the task enabled, and set the interval for 0. This forces the task to execute every minute. You can now wait a minute, and system b will request data from system a. System A will respond with an XML stream, which system B then updates it's data with the stream.

The following shows the instructions possible in both the requester and responder task lists.

Requester Task Reference

  • Task
    The required top node. Contains nodes that describes an action to be carried out. There can be a sequence of tasks in a task list.
    • Name
      The name of the task
    • SyncTable
      Requests a dataset from a remote datasource, and describes how that data will be saved when it is received
      • URL
        The url used to request the data from the remote source. For instance, to get data from the 'GetPeople' task of the RDS responder on Beta.Contensive.com, use http://beta.contensive.com/RDSResponder?task=GetPeople
      • Name
        The name of the local table where the data will be stored when it is returned
      • Key
        The name of the field in the database table that will be used as the key. The key field is the one that will determine if the incoming record matches a current record. For instance, if the incoming data contains a field name 'emailAddress' and you want that to be used to detect matching records with the 'email' field in your table, use 'email' as the key.
      • RowAlias
        The xml node that represents a row in the incoming data. The default is 'row'. Use this rowalias node if the data you are requesting is coming from a non-Contensive stream with different node names.
      • Field
        Each field node maps a field in the incoming data to a field in your database. For instance, if the incoming data contains 50 fields, but you only want to collect five of them, configure five field nodes.
        • Name
          The name of the field in your database where the data will be stored
        • Alias
          The name of the node in the incoming stream for this data
        • Type
          The type if data to be stored. Value types are:
          • Text
          • Date
          • Boolean
          • Integer
          • Number
          • TextFile
      • Value
        This is the defaul value to use if the incoming data does not contain this field
    • RunSQL
      Executes a database sql statement
      • SQL
        The database sql statement to run
    • SyncContent
      Requests a dataset from a remote datasource, and describes how that data will be saved when it is received.
      • URL
        The url used to request the data from the remote source. For instance, to get data from the 'GetPeople' task of the RDS responder on Beta.Contensive.com, use http://beta.contensive.com/RDSResponder?task=GetPeople
      • Name
        The name of the local content table where the data will be stored when it is returned
      • Key
        The name of the field in the content table that will be used as the key. The key field is the one that will determine if the incoming record matches a current record. For instance, if the incoming data contains a field name 'emailAddress' and you want that to be used to detect matching records with the 'email' field in your table, use 'email' as the key.
      • RowAlias
        The xml node that represents a row in the incoming data. The default is 'row'. Use this rowalias node if the data you are requesting is coming from a non-Contensive stream with different node names.
      • Field
        Each field node maps a field in the incoming data to a field in your database. For instance, if the incoming data contains 50 fields, but you only want to collect five of them, configure five field nodes.
        • Name
          The name of the field in your content table where the data will be stored
        • Alias
          The name of the node in the incoming stream for this data
      • Value
        The default value to use if the incoming data does not contain this field

Responder Task Reference

  • Task
    The required top node. Contains a sequence of commands to be executed when the responder is requested.
    • RunSQL
      Executes a database sql statement
      • SQL
        The database sql statement to run
    • SyncTable
      Selects records from the database, and formats them for delivery to a remote requester
      • SQL
        The database query that gathers the data to be sent in the data stream
      • RowAlias
        The xml node that represents a row in the outgoing data. The default is 'row'. Use this rowalias node if the data you are sending does not go to a Contensive RDS Requester.
      • Field
        Each field node maps a field in the incoming data to a field in your database. For instance, if the incoming data contains 50 fields, but you only want to collect five of them, configure five field nodes.
        • Name
          The name of the field in your database query
        • Alias
          The name of the node in the data stream for this field
        • Type
          The type if data to be sent. Value types are:
          • Text
          • Date
          • Boolean
          • Integer
          • Number
          • TextFile
    • SyncContent
      Selects records from a content table, and formats them for delivery to a remote requester.
      • SQL Criteria
        The criteria portion of the content select. For instance, if your content table is 'people', and you only want people with an email address, the criteria might be 'email is not null'
      • Name
        The name of the local content table where the data will be read
      • RowAlias
        The xml node that represents a row in the incoming data. The default is 'row'. Use this rowalias node if the data you are requesting is coming from a non-Contensive stream with different node names.
        • Field
          Each field node maps a field in the incoming data to a field in your database. For instance, if the incoming data contains 50 fields, but you only want to collect five of them, configure five field nodes.
        • Name
          The name of the field in your content table where the data will be stored
        • Alias
          The name of the node in the incoming stream for this data