0
votes

I have a scenario where I write some data to an azure storage blob, trigger an azure function to process the data, and write the result to another blob storage record. I've come across a weird scenarios where if the function hasn't triggered for a while(couple days) it will stop responding to the trigger unless I navigate to the azure portal and restart the function. This also happens when I use VSTS to publish the function in my CI/CD pipeline. Again, a restart is required.

To get around this, I would prefer to use an HTTP trigger where I can at least get a status code response to my request and have a better sense that my function has actually been triggered.

Here is the method for the blob trigger that is working:

[FunctionName("ProcessOpenOrders")]
public static async Task Run([BlobTrigger("%TriggerBlobPath%/{name}")]Stream myBlob, string name, TraceWriter traceWriter, [Blob("%OutboundBlobPath%/{name}", FileAccess.Write)] Stream outputStream, ExecutionContext context)

The TriggerBlobPath and OutboudBlobPath are slot setting configurations. This is important because I need the blob storage record name as a parameter so I know what to read and I use the same record name as the output.

For an HTTP trigger, I would need that name in a similar way. My question is how?

Something like this I'm guessing:

public static async Task Run([HttpTrigger] HttpRequestMessage request, [Blob("%InboundBlobPath%/{name}", FileAccess.Read)]Stream myBlob, string name, TraceWriter traceWriter, [Blob("%OutboundBlobPath%/{name}", FileAccess.Write)] Stream outputStream, ExecutionContext context)

but I get the following error:

Microsoft.Azure.WebJobs.Host: Unable to resolve binding parameter 'name'. Binding expressions must map to either a value provided by the trigger or a property of the value the trigger is bound to, or must be a system binding expression (e.g. sys.randguid, sys.utcnow, etc.).

If anyone knows how to implement an HttpTrigger in place of a blob trigger, but get the same functionality, that would be very helpful. Otherwise, if someone has an idea on how to guarantee that the blob trigger actually triggered, that would also be very helpful.

Thanks!

1
Is it a question about a binding problem ?Thomas

1 Answers

1
votes

I think the official guidance is to use Event Grid trigger to react on blob events. See Reacting to Blob storage events and Event Grid trigger for Azure Functions.