I am trying to use a SaaS File trigger to listen for new files in an FTP site. First of all, can you even define a variable folder, like "path": "inputTest/{folder}/{fileName}"? Or, perhaps, listen to new files in all subfolders and include the path in the file name, like inputTest/{file} where file might equal "subfolder/fileName.txt"? The idea here is that I will have multiple clients uploading files into their own directories, and I don't want to create a new function/trigger for each one.
The same thing goes for the output. I want a SasS File binding that can write to various folders. I think I can use the method described here, but I'll still need to test it out. The idea is that I want to stream the input file reading a line at a time, process the line in some way, and write it out to another file. Essentially a transform. There might be other ways to do this but I would like to understand this binding better.
UPDATE
I tried the following for the output binding:
using System;
using Microsoft.Azure.WebJobs;
public static void Run(string input, IBinder output, TraceWriter log)
{
string connectionStringSetting = Environment.GetEnvironmentVariable(
"ftp_FTP", EnvironmentVariableTarget.Process);
var path = "InputTest/SubFolder/fileName.txt";
log.Info($"Writing to {path}...");
using (var writer = output.Bind<TextWriter>(
new ApiHubFileAttribute(connectionStringSetting, path)))
{
writer.Write(input);
}
log.Info("Done writing...");
}
I included the Microsoft.Azure.WebJobs.Extensions.ApiHub NuGet package for the ApiHubFileAttribute. I got the error Exception binding parameter 'output'. Microsoft.Azure.WebJobs.Extensions.ApiHub: Unsupported type:Microsoft.Azure.WebJobs.IBinder. Any help would be appreciated.
IBinderyou should not have a mapped parameter in yourfunction.jsonfile for that parameter. That's why you're getting the error.