Azure Logic应用,队列中无内容

奥列格·舒(Oleg Sh)

我有以下触发器:

"triggers": {
    "When_there_are_messages_in_a_queue": {
        "inputs": {
            "host": {
                "connection": {
                    "name": "@parameters('$connections')['azurequeues']['connectionId']"
                }
            },
            "method": "get",
            "path": "/@{encodeURIComponent('drugconsortium-positive-result')}/message_trigger"
        },
        "recurrence": {
            "frequency": "Minute",
            "interval": 1
        },
        "splitOn": "@triggerBody()?['QueueMessagesList']?['QueueMessage']",
        "type": "ApiConnection"
    }
}

然后我尝试从队列中获取消息:

    "Get_messages": {
        "inputs": {
            "host": {
                "connection": {
                    "name": "@parameters('$connections')['azurequeues']['connectionId']"
                }
            },
            "method": "get",
            "path": "/@{encodeURIComponent('drugconsortium-positive-result')}/messages",
            "queries": {
                "visibilitytimeout": "30"
            }
        },
        "runAfter": {},
        "type": "ApiConnection"
    }

然后尝试发送包含队列内容的电子邮件:

"For_each_2": {
    "actions": {
        "Send_email_(V4)_3": {
            "inputs": {
                "body": {
                    "from": "[email protected]",
                    "ishtml": true,
                    "subject": "message",
                    "text": "<p>want!!!@{items('For_each_2')?['MessageText']}</p>",
                    "to": "[email protected]"
                },
                "host": {
                    "connection": {
                        "name": "@parameters('$connections')['sendgrid']['connectionId']"
                    }
                },
                "method": "post",
                "path": "/v4/mail/send"
            },
            "runAfter": {},
            "type": "ApiConnection"
        }
    },
    "foreach": "@body('Get_messages')?['QueueMessagesList']?['QueueMessage']",
    "runAfter": {
        "Get_messages": [
            "Succeeded"
        ]
    },
    "type": "Foreach"
}

执行后,我会看到一条触发消息:

{
  "MessageId": "83aac220-9ee5-440c-9a34-391abaa0e464",
  "InsertionTime": "Thu, 12 Mar 2020 20:21:51 GMT",
  "ExpirationTime": "Thu, 19 Mar 2020 20:21:51 GMT",
  "PopReceipt": "AgAAAAMAAAAAAAAA+JoXDKz41QE=",
  "TimeNextVisible": "Thu, 12 Mar 2020 20:23:09 GMT",
  "DequeueCount": "1",
  "MessageText": "{\"DriverId\":-1,\"DriverName\":\"John Smith\",\"DriverSSN\":\"111-11-1111\",\"CarrierName\":\"Carrier Name\",\"DER\":{\"Name\":\"Der name\",\"Email\":\"[email protected]\"}}"
}

Get_messages结果是:

QueueMessage : []

而且我没有收到任何电子邮件。怎么了?

这是因为您不需要Get_messages,检查触发器定义。当队列中有消息时,它将返回Messages类型,表示您已经获得消息。

由于触发器已经处理了队列,因此将从队列中将其删除,因此您无法通过该操作再次获取它。

因此,在触发之后,您可以获得带有动态内容的消息内容。

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Azure Logic应用-验证JSON文件中的内容

Azure Logic应用-获取Blob内容-设置内容类型

Azure Logic应用程序:从IoT中心消息中读取遥测数据作为动态内容

在Azure Function应用中限制Azure存储队列处理

在Azure Logic应用中解析JSON

在Azure Logic应用中解析文本

JavaScript中数组对象(Lodash,Azure函数,Azure Logic应用)

在Azure Logic应用条件中访问Azure SQL存储过程

Azure 队列删除其余 API 返回“无内容”,而删除 API 工作正常

Azure Function应用-无法从死信队列(DLQ)中检索

如何在Azure Logic App中解析BLOB文件的内容

在Azure Logic App中反序列化ServiceBus内容

如何使用azure函数应用读取azure blob中的内容

Azure Logic应用+ WCF中继?

删除Azure Logic应用中的现有连接

如何在Azure Logic应用中动态创建JSON对象?

Azure Logic应用-将电子邮件内容作为JSON返回

如何在Azure Logic应用中将CSV文件内容传递给Http Call

Azure Logic应用程序:从Blob存储中获取内容后,如何发送带有一个或多个附件的电子邮件?

Azure Function应用-输出到PHP队列

Azure Logic App服务总线消息内容

Azure Devops:无代理部署到 Azure 应用服务

使用托管身份从Azure Logic应用验证到Azure功能

在azure逻辑应用程序中,如何从azure服务总线主题中的死信队列中检索消息

Azure Logic应用HTTP侦听器

Azure Logic应用-JSON到XML的转换

使用CLI启用/禁用Azure Logic应用

Azure Logic应用-调用安全端点(TLS)

Azure Logic应用程序,入门配置