逻辑应用程序跳过每个内部的发送电子邮件操作

时间:2020-04-26 16:43:14

标签: c# azure-functions azure-logic-apps

我的逻辑应用程序具有HTTP触发器。每当我手动运行逻辑应用程序时,或者只是将URL复制并粘贴到浏览器中,它就会按预期运行。但是,当我使用QueueTriggered azure函数调用逻辑应用程序URL时,逻辑应用程序只是跳过了发送电子邮件操作。

Loggic app design (shows skipped actions)

Action inside ForEach

这是我的功能应用程序的代码:

public static async Task Run([QueueTrigger("messages", Connection = "ConnectionString")]string myQueueItem, ILogger log)
        {
            var httpClient = HttpClientFactory.Create();
            var url = "logicAppUri";

            await httpClient.GetAsync(url);

        }

消息的内容只是一个纯字符串,例如“ test”。

我还尝试将功能应用程序触发器更改为“当队列中有消息时”,但这也不起作用。

"When there are messages in the queue" trigger

Output

在两种情况下,我都从Azure收到相同的错误消息。

{"code":"ActionConditionFailed","message":"The execution of template action 'Send_email_(V2)' is skipped: there are no items to repeat."}

这没有意义,因为队列中有消息。

知道为什么会这样吗?

1 个答案:

答案 0 :(得分:0)

根据一些测试,此问题是由使用队列触发功能引起的。当队列中有新消息并读取消息时,将触发队列触发功能。因此,当httpClient以函数形式调用逻辑应用程序uri时,队列中没有消息。 “获取消息”操作将获得0大小列表,因此“对于每个”将执行0次。

根据您的要求,您可以仅在逻辑应用程序中使用“ When there are messages in a queue”。请参考下面的我的逻辑应用程序:

enter image description here

由于触发器将由每条消息触发,因此我们不需要使用“对于每个”来循环消息。

希望有帮助〜