Data Source Sync with EmbARK

Overview

When using Data Source Sync with EmbARK, there will be two different sync operations between NetX and the shadow database.

Initial Sync on Import

The initial sync operation will occur when an asset is first imported into the DAM. The purpose of this operation is to retrieve the Object ID for the asset. For this sync operation, the DAM will call a stored procedure in the shadow database, sending the asset filename as the single argument. This procedure will return the Object ID to assign to the asset as a single value.

 

Periodic Sync

This sync operation will run twice per day (sometime after 10am and 6pm, since these are the times that Embark data is synced with the shadow database, and we should start the sync after enough time has passed for that operation to complete.)

This sync operation is the primary mechanism to update asset metadata with new values from the shadow database. NetX will either call a query or a stored procedure that returns a result set to retrieve the data. Data rows in this result set will be matched to assets in the DAM using the Object ID assigned in the import sync task.

Configuration

AutoTask Configuration

There are two AutoTasks required for data syncing (in addition to any AutoTasks required for other elements of the workflows desired.)  The first autotask is to run the lookup sync task that retrieves the Object ID for the asset. The second configures the periodic sync job to occur at 10:30am and 6:30pm.

<?xml version="1.0" encoding="UTF-8"?>
<autotask>
<task name="Import asset sync">
<matchCriteria type="and">
<criteria type="action" value="import"/>
</matchCriteria>
<customJob param="filename" attribute="Object ID"
className="com.netxposure.products.imageportal.module.metadata.sync.job.UpdateValueSyncJob"/>
</task>
<task name="Morning metadata sync">
<matchCriteria type="or">
<criteria type="periodic" interval="daily" hour="10" minute="30" />
<criteria type="periodic" interval="daily" hour="18" minute="30" />
</matchCriteria>
<customJob className="com.netxposure.products.imageportal.module.metadata.sync.job.MetadataSyncJob"/>
</task>
</autotask>

Metadata Sync Configuration

The metadata sync system is configured with the syncedMetadata.xml file. Below is an example configuration based on the sync operations outlined above. 

The first sync task defined above corresponds to the initial asset import lookup of the Object ID value. A stored procedure is called, with the filename as its parameter, and the Object ID is returned, updating the Object ID attribute for the asset.

The second sync task defines the periodic metadata update. A set of fields are retrieved from the database, and corresponding attribute values are updated for matching assets (assets are matched based on the Object ID of the attribute matching the object_id column in the returned record set.)

<?xml version="1.0" encoding="UTF-8" ?>
<metadatasync>
<sync type="valuelookup" log="detail" name="Get Object ID">
<source name="ShadowDB" type="database"
jdbc="jdbc:sqlserver://127.0.0.1:1433;databaseName=EmbarkShadow"
query="EXEC sp_GetObjectID" username="username" password="password">
<param value="ASSET_FILENAME"/>
<field name="objectId" column="object_id"/>
</source>


<destination type="DAM">
<records name="Imported Asset" type="asset">
<map field="objectId" attribute="Object Id"/>
</records>
</destination>
</sync>


<sync type="scalar" log="detail" name="Update Metadata">
<source name="ShadowDB" type="database"
jdbc="jdbc:sqlserver://127.0.0.1:1433;databaseName=EmbarkShadow"
query="SELECT * FROM pending_data WHERE synced = 0 AND sync_failed = 0"
username="username" password="password">
<field name="recordId" column="record_id"/>
<field name="objectId" column="object_id"/>
<field name="title" column="title"/>
<field name="description" column="description"/>
<field name="color" column="color"/>
<field name="year" column="year"/>


<callback type="success"
sql="UPDATE pending_data SET synced = 1 WHERE id = %1"
param1="recordId" frequency="row"/>
<callback type="failure"
sql="UPDATE pending_data SET sync_failed = 1 WHERE id = %1"
param1="recordId" frequency="row"/>
</source>


<destination type="DAM">
<records name="Updated Assets" type="asset" />
<link field="objectId" attribute="Object Id" />


<map field="title" attribute="Title"/>
<map field="description" attribute="Description"/>
<map field="color" attribute="Color"/>
<map field="year" attribute="Year"/>
</records>
</destination>
</sync>
</metadatasync>
Was this article helpful?
0 out of 0 found this helpful