Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Digizuite DAM integration service provides an API where integration endpoints can register for notifications regarding asset and metadata changes. We have made it easy to setup the connection between Episerver and Digizuite. All you have to do it to add some configuration in the web.config and you Episerver instance will recive notifications from Digizuite whenever and asset changes.

In Episerver we have created a new ApiController, which is located at the following route [siteUrl]/digizuite/integration, this it the endpoint that recives the notifications from Digizuite. An important note here is that the endpoint should be reachable from the Digizuite server otherwise Digizuite wont be able to send the notifications. This is usually the case for developers on their local environment.

let talk about what the controller does when it recives an notification. The data coming from Digizuite will be serilized in to an object of this type:

Code Block
public class UpdateNotification
{
    public int ChangeType { get; set; }
    public ChangeData Data { get; set; }
}
public class ChangeData
{
    public int ItemId { get; set; }
    public int BaseId { get; set; }
}

The property ChangeType indicates wheter it is and AssetChanged, MetafieldChanged, ComboValueChanged or TreeValueChanged. If it is an AssetChanged we do the following:

  1. Delete blobs for the notified assetid.

  2. Delete database entries for the notified assetid.

The last thing we do it to raise an episerver event with the UpdateNotification object.

Code Block
languagec#
_eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId).RaiseAsync(
                GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeRaiserId, updateNotification, EventRaiseOption.RaiseBroadcast);

We also listning for the event and for AssetChanged we clear the in-memory cache and if the RaiserId is coming from another instance (broadcast) and the configuration “DeleteBlob” is true, then we delete the blobs and database entries for the notified assetid.

Code Block
var digizuiteIntegrationEvent = _eventRegistry.Get(GlobalConstants.ContentEventRegistry.DigizuiteAssetChangeEventId);
digizuiteIntegrationEvent.Raised += DigizuiteIntegrationEvent_Raised;

As an developer you can also build you own logic around the notifications from Digizuite, as you can listening for the event by register to the event, just as we do above.

1. Setup the endpoint

Open the web.config and locate the Digizuite node. The sub node “digizuiteIntegration” is the one we should update. Here you see an example where it has been configured.

Code Block
languagexml
<digizuiteIntegration siteUrl="http://my.episerverSite.dk" guid="e01553bd-f66a-4fba-8b6b-884133d8ae80" subscriptions="1" deleteBlob="false"/>

The siteUrl is the url to your episerver site. The guid is used as the unique id, when creating a new endpoint in Digizuite. The default value is empty so you have to generate a new one. The parameter subscription indicates which changetypes you want to listning for. The possible values can be found her DFE 2.0.0 - 3 Setting up Episerver. The default value is 1 which is AssetChanged. The last parameter deleteBlob indicates whether we should delete the blobs for the asset or not. In a load balanced invironment where you have multiple instances and each of the instances cantains it own local blob storage, then this should be true. If the blob storage is share between the instances then leave it false.

Once the change has been made and you reload the site, you should see the following log statment in the file Digizuite.log:

Code Block
2020-05-14 08:22:33,529 [1] INFO DigizuiteProviderInit::Initialize: DigizuiteIntegration has been setup and configured

2. Verify connection

If you have access to the Digizuite server. Open an browser from that server and access your episerver site. If you cannot access the site, Digizuite won't be able to send notifications to it.

If the server can access your site, then the next test would be to change an asset in Digizuite DAM and verify that the notification has been send to Episerver.

  1. Change the log level for the logger “Digizuite.Episerver.Helpers.Internal.Logger” to Debug or All.

  2. Reload the site.

  3. Go to Digizuite and find an asset that is published to the Episerver channel and change some of its metadata for example, the title. Now Digizuite will notify all registret integration endpoints with the update.

  4. You should see the following log statment in the log file Digizuite.log. This indicates that digizuite has delivered the notification to the apicontroller in Episerver.

    Code Block
    2020-05-15 11:20:45,828 [20] DEBUG DigizuiteIntegrationController::Update: DigizuiteIntegration Event, Type:1 ItemId:395810 AssetId:3247

  5. The next thing you can verify is that the metadata that you change is the same in Episerver.