如何使用Azure存储队列逻辑应用程序连接器设置队列消息的过期(TTL)?

问题描述 投票:0回答:1

在我的逻辑应用程序中,我看不到设置队列消息的TTL或过期日期。

Azure Put Message In Storage Queue Logic App Action

Settings for 'Put a message on a queue'

但是可以从UI中获取,所以我知道API可以做到:

Azure portal: updateuser

我甚至试图将messagettl查询字符串参数“hack”到代码视图中:

"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 azure-logic-apps azure-api-apps azure-storage-queues
1个回答
1
投票

我通过查看对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"
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.