[英]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 do.net.我正在关注使用 do.net 将 azure function 运行时从 v3 升级到 v4 的可能性。 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.
但是,我无法在队列触发器中获取消息元数据,例如 DequeueCount、MessageId 等。
Previously with in-process option, I used to bind CloudQueueMessage
but that doesn't seem to work in the isolated mode.以前使用进程内选项,我曾经绑定
CloudQueueMessage
但这似乎在隔离模式下不起作用。 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 绑定
[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.
简单的 JSON - Object 也可以。
Is there any way to get these message metadata (members of the CloudQueueMessage
) in the isolated azure function?有没有办法在隔离的 azure function 中获取这些消息元数据(
CloudQueueMessage
的成员)? Thanks.谢谢。
For DequeueCount property I use this:对于 DequeueCount 属性,我使用这个:
[Function("MyQueueTrigger")]
public void Run([QueueTrigger("my-queue-name")] string myQueueItem, int dequeueCount)
{
_logger.LogInformation("Queue item: {item}. Dequeue count: {dequeueCount}.", myQueueItem, dequeueCount);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.