moto 升级导致错误队列应启用 ContentBasedDeduplication 或显式提供 MessageDeduplicationId

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

我将 moto 从 4.1.x 升级到 4.2.x,现在运行 pytest 单元测试时遇到此错误。

botocore.exceptions.ClientError:调用 SendMessage 操作时发生错误 (InvalidParameterValue):队列应启用 ContentBasedDeduplication 或显式提供 MessageDeduplicationId

发生了什么事以及如何解决这个问题?

python amazon-web-services boto3 amazon-sqs moto
1个回答
0
投票

对我有用的解决方案是将

"ContentBasedDeduplication": "true"
添加为队列上的属性,即

    queue = client.create_queue(
        QueueName=queue_name,
        Attributes={
            ....
            "ContentBasedDeduplication": "true",
        }
    )

SQS 重复数据删除的工作方式似乎已被 this commit 改变,该提交出现在 4.1.7 中,并作为软件包升级的一部分被采用。

© www.soinside.com 2019 - 2024. All rights reserved.