SQS send_messages method response different from AWS resource
babaMar opened this issue · 5 comments
The following code:
import boto3
sqs_resource = boto3.resource('sqs', region_name='us-west-1')
sqs_queue = sqs_resource.get_queue_by_name(QueueName='test-queue')
res = sqs_queue.send_messages(Entries=[
{'Id': '1', 'MessageBody': json.dumps({'body': 'the body'})},
{'Id': '2', 'MessageBody': json.dumps({'body': 'the body'})},
{'Id': '3', 'MessageBody': json.dumps({'body': 'the body'})}
])
gives a different response from the one given when using a real AWS resource:
{'ResponseMetadata': {'RequestId': '00000000-0000-0000-0000-000000000000', 'HTTPStatusCode': 200, 'HTTPHeaders': {'server': 'akka-http/10.1.3', 'date': 'Wed, 17 Apr 2019 09:48:34 GMT', 'content-type': 'text/plain; charset=UTF-8', 'content-length': '356'}, 'RetryAttempts': 0}}
real-resource response:
{'ResponseMetadata': {'HTTPHeaders': {'content-length': '861',
'content-type': 'text/xml',
'date': 'Thu, 18 Apr 2019 10:10:42 GMT',
'x-amzn-requestid': '17e336a0-0649-5dc1-8c0f-6392492b6b4a'},
'HTTPStatusCode': 200,
'RequestId': '17e336a0-0649-5dc1-8c0f-6392492b6b4a',
'RetryAttempts': 0},
'Successful': [{'Id': '1',
'MD5OfMessageBody': '1b36e5c2aa17fe938e3fa648099afac7',
'MessageId': '510f82e2-6bc5-4ca5-acda-e74f7166782a'},
{'Id': '2',
'MD5OfMessageBody': '1b36e5c2aa17fe938e3fa648099afac7',
'MessageId': '3fd7c53e-ced4-48e1-8ed5-4402e0b7865b'},
{'Id': '3',
'MD5OfMessageBody': '1b36e5c2aa17fe938e3fa648099afac7',
'MessageId': '8be0c543-e77f-42d0-a297-62b289481ea2'}]}
Hi @roribio,
yeah I realized that, when I run ElasticMQ locally it actually returns the correct response tho, that's why I opened this issue.
I see 🤔 Could you provide more info to help debug this issue? For example, which version of ElasticMQ are you running locally? Which version of alpine-sqs are you running?
Any details that you can provide will help.
Thanks!
For both containers I use to pull images, so versions that come with softwaremill/elasticmq
and roribio16/alpine-sqs
This is caused by SQS insights in the container receiving the messages and causing the visibility timeout to begin. Your code is trying to receive messages from the queue which are inflight. I worked around this issue by turning off SQS insights (the web UI).