在我的逻辑应用中,我看不到如何设置队列消息的 TTL 或过期日期。
但是可以通过 UI 实现,所以我知道 API 可以做到这一点:
我什至尝试将 messagettl 查询字符串参数“破解”到代码 View 中:
"actions": {
"Put_a_message_on_a_queue": {
"inputs": {
"body": "@{base64(items('For_each'))}",
"host": {
"connection": {
"name": "@parameters('$connections')['azurequeues']['connectionId']"
}
},
"method": "post",
"path": "/@{encodeURIComponent('updateuser')}/messages?messagettl=3600"
},
"runAfter": {},
"type": "ApiConnection"
}
}
但是我收到一个错误:
{
"message": "Unable to match incoming request to an operation."
}
最佳答案
我通过查看对 Azure 门户中的添加队列消息 UI 进行的 API 调用发现了这一点。它附加一个查询字符串参数 messagettl
,即 TTL 秒。
所以,我查看了架构 here并发现您可以将 "queries": {...}
对象传递给 HTTP 调用以添加消息。
最终代码查看 JSON:
"actions": {
"Put_a_message_on_a_queue": {
"inputs": {
"body": "@{base64(items('For_each'))}",
"host": {
"connection": {
"name": "@parameters('$connections')['azurequeues']['connectionId']"
}
},
"method": "post",
"path": "/@{encodeURIComponent('updateuser')}/messages",
"queries": {
"messagettl": 3600
}
},
"runAfter": {},
"type": "ApiConnection"
}
}
关于azure - 如何使用 Azure 存储队列逻辑应用连接器设置队列消息的过期时间 (TTL)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55497864/