Creates an Amazon SQS queue. :param name: The name of the queue. This is part of the URL assigned to the queue. :param attributes: The attributes of the queue, such as maximum message size or whether it's a FIFO queue. :return: A Queue object that contains me
(name, attributes=None)
| 22 | |
| 23 | # snippet-start:[python.example_code.sqs.CreateQueue] |
| 24 | def create_queue(name, attributes=None): |
| 25 | """ |
| 26 | Creates an Amazon SQS queue. |
| 27 | |
| 28 | :param name: The name of the queue. This is part of the URL assigned to the queue. |
| 29 | :param attributes: The attributes of the queue, such as maximum message size or |
| 30 | whether it's a FIFO queue. |
| 31 | :return: A Queue object that contains metadata about the queue and that can be used |
| 32 | to perform queue operations like sending and receiving messages. |
| 33 | """ |
| 34 | if not attributes: |
| 35 | attributes = {} |
| 36 | |
| 37 | try: |
| 38 | queue = sqs.create_queue(QueueName=name, Attributes=attributes) |
| 39 | logger.info("Created queue '%s' with URL=%s", name, queue.url) |
| 40 | except ClientError as error: |
| 41 | logger.exception("Couldn't create queue named '%s'.", name) |
| 42 | raise error |
| 43 | else: |
| 44 | return queue |
| 45 | |
| 46 | |
| 47 | # snippet-end:[python.example_code.sqs.CreateQueue] |
no test coverage detected