list_queues ( QueueNamePrefix = 'test_queue' ) # we filter to narrow down the list test_queue_url = queues # send 100 messages to this queue for i in range ( 0, 100 ): # we set a simple message body for each message # for FIFO queues, a 'MessageGroupId' is required, which is a 128 char alphanumeric string enqueue_response = client. create_queue ( QueueName = 'test_queue' ) # get a list of queues, we get back a dict with 'QueueUrls' as a key with a list of queue URLs queues = client. fifo, and you must pass FifoQueue = True client. client ( 'sqs' ) # create the test queue # for a FIFO queue, the name must end in. #!/usr/local/bin/python3 import boto3 # create a boto3 client client = boto3. We will use a standard queue, for FIFO Queues, see notes in the comments below. Location: /Library/Frameworks/amework/Versions/3.6/lib/python3.6/site-packages To install Boto 3, type pip3 install boto3 on the shell prompt. Please see this post for details on installing and getting started with Python 3. You should already have python3 and pip3 installed. Here is a quick tutorial to familiarize yourself with SQS. You should already have an AWS account, and AWS configured on your development machine via AWS CLI’s aws configure command. If you’re used to JMS, then you may need some pivoting, as SQS is not exactly a JMS provider, but there is a library that can be used as a bridge between JMS and SQS. We use SQS heavily at Marqeta for various integration patterns. This allows for decoupling various components of the architecture, and cleaner hand-off of responsibilities across them. SQS is a highly available and scalable PaaS for Messaging. In this post we will use SQS and boto 3 to perform basic operations on the service. Its fun, easy, and pretty much feels like working on a CLI with a rich programming language to back it up. In fact, this SDK is the reason I picked up Python - so I can do stuff with AWS with a few lines of Python in a script instead of a full blown Java setup.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |