I'm implementing the claim check pattern with Azure Functions and Azure Service Bus.
My Azure Function has a ServiceBusTrigger
, which works correctly by itself.
public async Task Run(
[ServiceBusTrigger("worker", Connection = "SERVICE_BUS_CONNECTION")] string json,
ILogger log)
{
var notificationCommand = JsonConvert.DeserializeObject<NotificationCommand>(json, new JsonNotificationCommandConverter());
The serialized claim check messages from the bus look something like this:
{
"type": "claim-check",
"product": "XYZ",
"payloadRef": "https://{storage-account}/{container}/{blob_id}"
}
I would like to be able to just use a Blob
input binding to get the payload reference from BLOB storage without having to do it manually, but I'm having some issues with the binding expressions - I'm not even sure if it's possible to do what I'm attempting...
Basically I want to do the following:
public async Task Run(
[ServiceBusTrigger("worker", Connection = "SERVICE_BUS_CONNECTION")] string json,
[Blob("{PayloadReference}", FileAccess.Read, Connection = "BLOB_STORAGE_CONNECTION")] Stream myBlob,
ILogger log)
{
var notificationCommand = JsonConvert.DeserializeObject<NotificationCommand>(json, new JsonNotificationCommandConverter());
where Blob("{PayloadReference}"
refers to a property in the json message from the bus.
Is it possible? and if so how do I do it...