you should use a POCO object in the queue trigger binding, see the following example:
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using System.IO;
using System.Threading.Tasks;
namespace FunctionApp13
{
public static class Function9
{
[FunctionName("Function9")]
public static async Task Run(
[QueueTrigger("azure-webjobs-retry", Connection = "rk2018storagev2_STORAGE")]Payload myQueueItem,
[Blob("{ContainerName}/{BlobName}", FileAccess.Read, Connection = "rk2018storagev2_STORAGE")] string myBlobItem,
ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
log.LogInformation($"Blob Content: {myBlobItem}");
await Task.CompletedTask;
}
}
public class Payload
{
public string ContainerName { get; set; }
public string BlobName { get; set; }
public override string ToString()
{
return $"{ContainerName}/{BlobName}";
}
}
}
For portal:
run.csx:
using System;
public static async Task Run(Payload myQueueItem, string myBlobItem, ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
log.LogInformation($"Blob Content: {myBlobItem}");
await Task.CompletedTask;
}
public class Payload
{
public string ContainerName { get; set; }
public string BlobName { get; set; }
public override string ToString()
{
return $"{ContainerName}/{BlobName}";
}
}
function.json:
{
"bindings": [
{
"name": "myQueueItem",
"type": "queueTrigger",
"direction": "in",
"queueName": "azure-webjobs-retry",
"connection": "rk2018storagev2_STORAGE"
},
{
"type": "blob",
"name": "myBlobItem",
"path": "{ContainerName}/{BlobName}",
"connection": "rk2018storagev2_STORAGE",
"direction": "in"
}
],
"disabled": false
}
Test:
{
"ContainerName":"test",
"BlobName":"abc.json"
}