MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / create_queue

Function create_queue

python/example_code/sqs/queue_wrapper.py:24–44  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

22
23# snippet-start:[python.example_code.sqs.CreateQueue]
24def 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]

Callers 1

usage_demoFunction · 0.85

Calls 1

create_queueMethod · 0.80

Tested by

no test coverage detected