Our application uses amazon's SQS for message queues and we use elasticMQ for testing/staging; elasticMQ is a message queue server that is fully compatible with SQS. Since the majority of our application is in java, we can run embedded elasticMQ in our tests or staging, switch over our queue endpoints to point to elasticMQ and voila, everything works very nicely and we don't touch our production queues.
That being said, we have some of our application written in python - which uses boto3 for SQS requests. Since elasticMQ can also be run as a standalone application I was wondering if it was possible to switch the endpoint from the default url (sqs.region.amazonaws.com:80) to something else (localhost:9324) in boto3. I've scoured the documentation and SO but haven't been able to identify if what I'd like to do is even possible.
To get the queue URL, use the `` GetQueueUrl `` action. `` GetQueueUrl `` requires only the QueueName parameter. be aware of existing queue names: If you provide the name of an existing queue along with the exact names and values of all the queue's attributes, CreateQueue returns the queue URL for the existing queue.
Priority: Use separate queues to provide prioritization of work. Scalability: Because message queues decouple your processes, it's easy to scale up the send or receive rate of messages — simply add another process. Resiliency: When part of your system fails, it doesn't need to take the entire system down.
To encode a single Amazon SQS message attributeEncode the transport type ( String or Binary ) of the value (1 byte). The logical data types String and Number use the String transport type. The logical data type Binary uses the Binary transport type. For the String transport type, encode 1.
You can pass in the endpoint_url
to the client / resource constructor.
import boto3
sqs = boto3.resource('sqs')
emq = boto3.resource('sqs', endpoint_url="http://www.foo.com")
docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With