Hi all,
I'm trying to use ElasticMQ as a local-development alternative for SQS. However, I'm having trouble dropping it in place of SQS with my
Celery setup. Right now, I'm trying the following:
settings.py
region = boto.sqs.regioninfo.RegionInfo(name='elasticmq', endpoint="127.0.0.1")
BROKER_URL = "sqs://x:x@"
BROKER_TRANSPORT_OPTIONS = {'regioninfo': region, 'port': 9324}
app.py
app = Celery('test_proj', include=['workflow.processor', 'workflow.writer'])
app.config_from_object('celeryconfig')
app.conf.update(BROKER_URL=settings.BROKER_URL)
app.conf.update(BROKER_TRANSPORT_OPTIONS=settings.BROKER_TRANSPORT_OPTIONS)
# Optional configuration, see the application user guide.
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
)
if __name__ == '__main__':
app.start()
Attempting to run this results in various connection errors. Celery displays the transport as being: "transport: sqs://x:**@localhost//", but things appear to be trying to hit AWS:
[2015-09-07 02:08:08,902: DEBUG/MainProcess] Final headers: {'Host': 'queue.amazonaws.com', 'User-Agent': 'Boto/2.38.0 Python/3.4.0 Linux/3.13.0-55-generic', 'Authorization': 'AWS4-HMAC-SHA256 Credential=x/20150907/us-east-1/sqs/aws4_request,SignedHeaders=host;x-amz-date,Signature=<snip>', 'X-Amz-Date': '20150907T020808Z', 'Content-Length': '0'}
[2015-09-07 02:08:08,974: DEBUG/MainProcess] wrapping ssl socket; CA certificate file=/opt/app-venv/lib/python3.4/site-packages/boto/cacerts/cacerts.txt
[2015-09-07 02:08:09,036: DEBUG/MainProcess] validating server certificate: hostname=queue.amazonaws.com, certificate hosts=['sqs.us-east-1.amazonaws.com', 'queue.amazonaws.com']
[2015-09-07 02:08:09,105: DEBUG/MainProcess] Response headers: [('Server', 'Server'), ('Date', 'Mon, 07 Sep 2015 02:08:09 GMT'), ('Content-Type', 'text/xml'), ('Content-Length', '311'), ('Connection', 'keep-alive'), ('x-amzn-RequestId', '5c83024a-4e21-5a2c-8307-4c2cbde88d6b')]
[2015-09-07 02:08:09,106: DEBUG/MainProcess] b'<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>InvalidClientTokenId</Code><Message>The security token included in the request is invalid.</Message><Detail/></Error><RequestId>5c83024a-4e21-5a2c-8307-4c2cbde88d6b</RequestId></ErrorResponse>'
[2015-09-07 02:08:09,106: ERROR/MainProcess] 403 Forbidden
[2015-09-07 02:08:09,106: ERROR/MainProcess] b'<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>InvalidClientTokenId</Code><Message>The security token included in the request is invalid.</Message><Detail/></Error><RequestId>5c83024a-4e21-5a2c-8307-4c2cbde88d6b</RequestId></ErrorResponse>'
[2015-09-07 02:08:09,109: ERROR/MainProcess] consumer: Cannot connect to sqs://x:**@localhost//: SQSError: 403 Forbidden
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>InvalidClientTokenId</Code><Message>The security token included in the request is invalid.</Message><Detail/></Error><RequestId>5c83024a-4e21-5a2c-8307-4c2cbde88d6b</RequestId></ErrorResponse>.
Trying again in 2.00 seconds...
I'm able to run the sample boto example in the ElasticMQ docs, including invoking list queues endpoint.
Any pointers would be appreciated!
Regards,
~Aru