AWS SQS FIFO队列:如何在Mule 4的Send Message组件上设置MessageGroupId

问题描述

UseCase :使用Mule Amazon SQS Connector 5.6将消息发送到AWS SQS FIFO队列名称​​ muleTesting.fifo

实施https://docs.mulesoft.com/amazon-sqs-connector/5.6/amazon-sqs-connector-examples

问题:如何使用Mule SQS连接器在SendMessageRequest上添加MessageGrouperID参数,以下内容在SendMessage Mule组件上给出了错误

{
    body: "Hello World",messageAttributes: {
        "AccountId": {
            "stringValue" : "000123456","dataType" : "String.AccountId"
        } as Object {
            class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
        },"NumberId": {
            "stringValue" : "230.000000000000000001","dataType" : "Number"
        } as Object {
            class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
        }
    } as Object {
        class: "java.util.HashMap"
    }
} as Object {
    class: "org.mule.extension.sqs.api.model.Message"
}

错误

“请求必须包含参数MessageGroupId。(服务:AmazonSQS;状态代码:400;错误代码:MissingParameter;请求ID:43ce279b-5972-5df0-bff5-706ac30f8b29;代理服务器:空)”

解决方法

您应该能够像这样将 groupId 属性添加到您的负载中。

{
    body: "Hello World",groupId: "GroupName",messageAttributes: {
        "AccountId": {
            "stringValue" : "000123456","dataType" : "String.AccountId"
        } as Object {
            class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
        },"NumberId": {
            "stringValue" : "230.000000000000000001","dataType" : "Number"
        } as Object {
            class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
        }
    } as Object {
        class: "java.util.HashMap"
    }
} as Object {
    class: "org.mule.extension.sqs.api.model.Message"
}