在S / S的SQS队列中设置消息的消息属性?

时间:2016-09-14 20:38:20

标签: boto amazon-sqs

有没有办法在SQS队列中设置消息的消息属性?我试图检查发送到SQS队列的消息并更改其值。下面代码的最后一行获取并打印该值。

for message in queue.receive_messages(MaxNumberOfMessages=10, AttributeNames=['All'], MessageAttributeNames=['All']):
    print(message.body)
    print(message.attributes)
    print(message.message_attributes)
    print(message.message_attributes.get('attr').get('StringValue'))

我想在此邮件中设置 attr StringValue 。有没有办法做到这一点?我更喜欢使用 boto (而非 boto3 )来实现此目的。

1 个答案:

答案 0 :(得分:1)

一旦将消息发送到队列,SQS消息的消息属性就是不可变的。 SQS查询API(由所有客户端库使用)不支持修改队列中的消息,除了更改其可见性超时。