逻辑应用总是需要 30 秒才能读取空服务总线队列

Logic App always takes 30s to read empty service bus queue

我有一个逻辑应用程序,它具有“从服务总线队列获取消息(窥视锁定)”操作。我经常希望此操作 return 没有任何消息,所以我检查响应的长度以查看它是否为 0,如果是这样的话,我会继续做一些工作来填充队列。

我的问题是当队列为空时,读取服务总线的操作需要 30 秒。这会导致对逻辑应用程序调用方的响应出现显着延迟。

我怎样才能让这个动作更快超时?

我查看了操作设置,其中描述了一项

Timeout

Limit the maximum duration an asynchronous pattern may take. Note: this does not alter the request timeout of a single request.

我不完全确定这是什么意思,但我认为这是响应的异步轮询应该持续多长时间。

将此值更改为 PT10S 没有任何效果。

我怀疑问题是对服务总线的调用是一个长轮询,它被硬编码为在 30 秒后超时 - 谁能证实或反驳这个?

有什么办法可以减少这个时间吗?

Timeout

Limit the maximum duration an asynchronous pattern may take. Note: this does not alter the request timeout of a single request.

此设置不会影响操作持续时间,因为服务总线获取操作和触发器实现单个 http 请求(轮询内部队列)而不是异步回调。

I suspect the problem is that the call to the Service Bus is a long poll that is hardcoded to timeout after 30s - can anyone confirm or refute this?

根据我对连接器的理解,获取服务总线操作和触发器实现了 30 秒的长轮询,您无法更改。

Update 除了按照下面的建议使用 Azure 函数之外,您还可以在实现并行分支的嵌套逻辑应用程序中抽象 GetMessages 调用。一个分支将从队列中读取,而另一个分支会 return 如果主分支花费的时间超过您的阈值,则会发出超时响应。 该模式在此处解释 http://mikaelsand.se/timeout-and-parallel-branches-in-logic-apps/

HTH