FRENDS

Extending FRENDS Cobalt

By default, FRENDS Cobalt only transfers files from one folder or remote FTP/SFTP directory to another, with the possibility of doing an XSL transformation to the files during transfer. This is good enough for many situations, but often you have some special requirements, e.g. that the files should be validated, or transformed from flat file to XML. For these kinds of scenarios FRENDS Cobalt allows you to create custom endpoints and message processing steps.

Note: FRENDS Cobalt uses the Rebex File Transfer Pack for FTP, FTPS, SFTP and SCP connections. To develop extensions that use the Rebex libraries, you will have to buy a license from Rebex

Sample projects

The solution, Frends.Cobalt.Extensions, which contains the projects Frends.Cobalt.Extensions, Frends.Cobalt.Extensions.Tests and Frends.Cobalt.TestUtilities, is located in "<Cobalt installation directory>\Documentation\Extensions\Frends.Cobalt.Extensions.zip" zip file.

The solution contains all the needed references, located in lib folder, and is buildable from Visual Studio 2008 straight away.

Below are links to guides on how to create custom endpoints and custom message processing steps.

Creating a custom endpoint

You can create a custom endpoint that e.g. extends the FTP endpoint to fetch files from many source directories, or create a new endpoint implementation by extending from the abstract EndPointBase class e.g. HTTP endpoint.

Extension example: SCP Endpoint

SCP is a legacy protocol used for transferring files between systems, it has been widely replaced by SFTP except on some old systems. We have made a sample endpoint extension for SCP, note that does not support all the options FRENDS Cobalt has to offer as SCP is quite a limited protocol.

Creating a custom message processing step

You can create a custom message processing step by inheriting and overriding the MessageProcessingStepBase.

MessageProcessingStep life cycle

The message processing steps are initialized once in the file transfer process life cycle and reused for processing each transferred file. The message processing steps are initialized in the beginning of the file transfer process and disposed after the process is finished.

Message processing step transfer context

Message processing steps receive ExtendedTransferContext object as parameter for their Execute method they need to implement. ExtendedTransferContext contains the following properties the custom message processing step developer can access:

Note: In Cobalt 1.7 the type of parameter was TransferContext that contained mostly same parameters as current version, but few parameters weren't present:

Adding custom data

In some cases you may have a need to be able to share data between endpoints and message processing steps. One such case could be a situation in which you receive several types of files in one directory and they need to be transferred to different locations based on the contents of the file. Such behaviour can be utilized by creating a custom message processing step for inspecting the file contents and a custom endpoint which handles the transfer of files to correct location accordingly by adding custom data during execution.