In a previous post, we taught you how to automatically transfer files from SFTP to Azure Blob Storage using a JSCAPE MFT Server network storage object. This time, we'll show you how to do it using a trading partner object.
Watch the video
Would you prefer to watch a video showing how to automatically transfer files from SFTP to Azure Blob Storage via Trading Partner? If so, you may play the video below. Otherwise, just skip it if you wish to continue reading.
If you recall, a network storage is suitable for cases when you want SFTP-uploaded files to be transferred straight to Azure Blob Storage upon upload. Meaning, none of those files will ever have to be stored on a drive directly attached to your JSCAPE MFT Server instance. But what if you want those files to be stored locally, either temporarily or permanently, and then automatically transfer those files to Azure Blob Storage at a later time? A more suitable solution for this would be to use an Azure Blob Storage trading partner object in conjunction with a trigger. We'll show you how to set up that solution here.
First, let me assume you already have an Azure Blob and perhaps a folder underneath it, where you want to transfer your SFTP-uploaded files into. In my case, I have an Azure blob named 'jcpv-test' and a folder named 'folder1' where I'm going to transfer my SFTP-uploaded files to.
Let's now head back to our JSCAPE MFT Server instance. As you can see, I have an SFTP service here. This is the SFTP service through which files will be initially uploaded to.
In our Users module, we have a user account named tp1. Let's say, for example, this user account ...
... has a virtual path named 'fors3' and it's mapped to the local path C:\for_s3.
So, when tp1 connects via SFTP and uploads files to the virtual path named '/fors3', those uploaded files will be stored in the local path C:\for_s3.
Ok. Just take note of that.
Let's now proceed to our Trading Partners module and create a trading partner object ...
... with protocol type Microsoft Azure Blob Service.
Let's give this trading partner object a name, say, 'tp-azureblob'.
Because the Azure blob we'll be connecting to requires a secure connection, I'm just going to check the Use SSL checkbox here.
Next, let's enter our Azure storage account name and its corresponding access key.
And then let's click the Test Server button to test the connection.
If the test succeeds, we can then click all succeeding OK buttons until we're back at the main screen.
Now that we have our Azure Blob trading partner object ready, the next step is to create a trigger that would automatically transfer those SFTP-uploaded files to Azure Blob via our newly created Azure Blob trading partner.
Let's navigate to our Triggers module and add a new trigger.
We're then given the option to specify a trigger template that best suits our desired workflow. Let's just skip using a template for now and just click OK.
Next, give your trigger a name, say, 'weekend uploads to s3'.
Because we want this trigger to fire on a predefined schedule, let's select the Current Time event type and then click Next to proceed.
In the Trigger Conditions dialog, we'll build an expression that lets this trigger execute every Saturday at 11:30 PM.
For more information on using the Expression Builder, read the post Introducing the New Trigger Conditions Expression Builder.
After clicking Next, we'll be brought to the Trigger Actions dialog, where we can add a new trigger action. Let's click Add to add a new trigger action.
The trigger action we'll be using is the Trading Partner Regex File Upload action. This trigger action will use a regular expression to match a set of files in a specified local directory and then upload those files to a specified trading partner.
First, we need to select the Azure Blob trading partner we created earlier. Next, we need to specify the local directory where this trigger action will retrieve files from. We want this action to retrieve files from the same local directory where those SFTP-uploaded files are stored, so we just select 'C:\for_s3'.
We then pick Wildcard from the Expression Type drop-down list and then enter '*.*' in the Regular Expression field. This will match all files in the specified local directory.
Lastly, we enter the destination Azure Blob folder path into the Remote Directory field. So, in our case, that would be 'jcpv-test/folder1'.
In the event you wish to delete the original files after a successful upload, you may tick the Delete on Success check box. Once you're done, click OK.
Lastly, drag an arrow from the Start output of the Workflow node to the Execute input of the Trading Partner Regex File Upload node. For more information on how to work with these flowcharts, read the blog post Introducing the Redesigned Trigger Action Workflow.
Once you're done, click OK until you're back at the main screen.
That's it. Now you know how to automatically transfer files from SFTP to Azure Blob Storage using a JSCAPE MFT Server trading partner object.
Try this yourself
Would you like to try this yourself? Download the FREE, fully-functional Starter Edition of JSCAPE MFT Server now.