My scenario for an Azure function:
- HTTP trigger.
- Based on HTTP parameters I want to read messages from an appropriate storage queue and return data back.
Here is the code of the function (F#):
let Run(request: string, customerId: int, userName: string, binder: IBinder) =
let subscriberKey = sprintf "%i-%s" customerId userName
let attribute = new QueueAttribute(subscriberKey)
let queue = binder.Bind<CloudQueue>(attribute)
() //TODO: read messages from the queue
The compilation succeeds (with proper NuGet references and opening packages), but I get the runtime exception:
Microsoft.Azure.WebJobs.Host:
Can't bind Queue to type 'Microsoft.WindowsAzure.Storage.Queue.CloudQueue'.
My code is based on an example from this article.
What am I doing wrong?
Update: now I realize I haven't specified Connection Name anywhere. Do I need a binding for the IBinder
-based queue access?
Update 2: my function.json
file:
{
"bindings": [
{
"type": "httpTrigger",
"name": "request",
"route": "retrieve/{customerId}/{userName}",
"authLevel": "function",
"methods": [
"get"
],
"direction": "in"
}
],
"disabled": false
}