Creating Transfer Extensions



Prerequisites

  1. .Net Core SDK

  2. .Net IDE of choice

  3. Access to the DryvIQ SDK packages

  4. DryvIQ SDK custom project template

  5. Basic understanding of creating a DryvIQ Platform extension


Getting Started

The DryvIQ Platform allows users to connect to on-premise and cloud storage platforms and orchestrate the content contained within those platforms. In order to orchestrate the content, DryvIQ will create a pipeline that facilitates pulling content from a source and transferring it to a destination. This pipeline can be configured based on user-configured options and available custom extensions. This creates an opportunity for extension developers to contribute to this pipeline to facilitate custom behavior such as manipulating permissions or custom metadata or transforming content from one format to another. In fact, a large majority of functionality within the transfer engine is built using this same extension mechanism. 


Creating Your First Transfer Extension

In the previous tutorial, we created a basic platform extension. We also mentioned some additional parameters that can be used to customize the project that is generated by the template. One of those parameters is --extension. It can be used to specify the exact type of extension that you would like to create. One of the available options is --extension=transfer that customizes the project as a transfer pipeline extension:

dotnet new skysynclib --name MyTransferExtension --extension transfer

 

Just as we had to do in the previous tutorial, we need to create a solution and add our new projects to it.

cd MyTransferExtension dotnet new solution dotnet sln add src\MyTransferExtension\MyTransferExtension.csproj dotnet sln add test\MyTransferExtension.Tests\MyTransferExtension.Tests.csproj


Creating a Transfer Filter Extension

There are a number of different methods that can be used to extend the transfer pipeline from the high-level transfer extensions API to the level operation interceptor API. In this example, we will create a transfer filter extension to automatically filter out everything except PDF files. This can be useful in trying to prevent Office files that are actively being collaborated on and only including published content in the destination. 

The first step is to modify our CustomServiceExtension class, which derives from IServiceCollectionExtension. Extensions of this type are automatically picked up and called while DryvIQ is starting up. This allows extension developers to register services with the same dependency injection container that DryvIQ uses. In order to modify the transfer pipeline, we first need to get access to it. This is required regardless of how we want to extend the transfer engine. We do that by adding a transfer pipeline extension.


CustomServiceExtension.cs

public void ConfigureServices(IServiceCollection services) { services.AddTransferPipelineExtension((options, src, dest, sp, pipeline) => { // Modify the pipeline to suite our needs return pipeline; }); }


This gives us access to the raw pipeline that will be used during transfer execution as well as the user-configured options and the source and destination connection instances. Since we want to apply a filter to all files, we will call an extension method that modifies the pipeline accordingly. 


CustomServiceExtension.cs


Deployment

During development of this extension, it is recommended to just build the extension using dotnet build, which will build your extension in the Debug configuration as well as copy the extension into the appropriate directory on your machine for DryvIQ to pick it up if you have a local copy that you can use to test live within the product. However, once you are ready to deploy this extension to customers then you will want to package the extension as a NuGet package (.nupkg file) using dotnet pack --configuration Release and deploy it to a DryvIQ instance.



DryvIQ Migrate Version: 5.9
Release Date: October 18, 2024