Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get message metadata in isolated Azure functions v4 - Queue Trigger in c#

I am following on a possible upgrade of azure function runtime from v3 to v4 with dotnet. While doing so, I am testing out the isolated option for the project. However I am unable to get message metadata such as DequeueCount, MessageId etc in the queue trigger.

Previously with in-process option, I used to bind CloudQueueMessage but that doesn't seem to work in the isolated mode. Doing so, throws and error -

Cannot convert input parameter 'myQueueItem' to type 'Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage' from type 'System.String'

This was my isolated queue function binding

[Function("TestApp")]
public void Run([QueueTrigger("sample-queue", Connection = "")] CloudQueueMessage myQueueItem, FunctionContext context)

After looking for a while, I think here it says that, in isolated process we can only bind string. Simple JSON - Object also works.

enter image description here

Is there any way to get these message metadata (members of the CloudQueueMessage) in the isolated azure function? Thanks.

like image 676
Gautam Kumar Samal Avatar asked Dec 19 '25 16:12

Gautam Kumar Samal


1 Answers

For DequeueCount property I use this:

[Function("MyQueueTrigger")]
public void Run([QueueTrigger("my-queue-name")] string myQueueItem, int dequeueCount)
{
    _logger.LogInformation("Queue item: {item}. Dequeue count: {dequeueCount}.", myQueueItem, dequeueCount);
}
like image 171
Ilya Nechapurenka Avatar answered Dec 21 '25 05:12

Ilya Nechapurenka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!