Reputation: 1507
Is there a way to set a message attribute of a message in an SQS queue? I am trying to examine a message sent to an SQS queue and change its value. The last line of the code below gets and prints the value.
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'))
I would like a way of setting the StringValue of attr in this message. Is there any way of doing that? I would prefer a way of doing this using boto (rather than boto3).
Upvotes: 4
Views: 3454
Reputation: 178956
The message attributes of an SQS message are immutable once the message has been sent to the queue. The SQS Query API (used by all client libraries) has no support for modifying a message in the queue, other than to change its visibility timeout.
Upvotes: 7