逻辑应用会跳过每个内部的发送电子邮件操作
Logic app skips send email action inside for each
我的逻辑应用有一个 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",但这也没有用。
"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."}
这没有意义,因为队列中有消息。
知道为什么会这样吗?
根据一些测试,这个问题是使用队列触发函数引起的。当队列中有新消息并读取消息时,队列触发函数将被触发。因此,当 httpClient
在函数中调用逻辑应用程序 uri 时,队列中没有消息。 "Get messages" 操作将获得 0 大小的列表,因此 "For each" 将执行 0 次。
根据您的要求,您可以在逻辑应用程序中使用“When there are messages in a queue”。请参考下面我的逻辑应用程序:
由于触发器会被每条消息触发,所以我们不需要使用"For each"来循环消息。
希望对你有帮助~
我的逻辑应用有一个 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",但这也没有用。
"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."}
这没有意义,因为队列中有消息。
知道为什么会这样吗?
根据一些测试,这个问题是使用队列触发函数引起的。当队列中有新消息并读取消息时,队列触发函数将被触发。因此,当 httpClient
在函数中调用逻辑应用程序 uri 时,队列中没有消息。 "Get messages" 操作将获得 0 大小的列表,因此 "For each" 将执行 0 次。
根据您的要求,您可以在逻辑应用程序中使用“When there are messages in a queue”。请参考下面我的逻辑应用程序:
由于触发器会被每条消息触发,所以我们不需要使用"For each"来循环消息。
希望对你有帮助~