View a markdown version of this page

CreateQueue - Amazon Kinesis Data Streams Service

CreateQueue

Creates a queue on the specified data stream. A queue delivers records from the stream to a queue consumer, tracks the delivery state of each record, and redelivers any record that is not acknowledged before its visibility timeout expires.

A queue does not extend how long the stream keeps a record. When a record reaches the end of the data stream's retention period, the queue stops delivering it.

Your queue consumer calls ReceiveQueueRecords to receive up to 10 records at a time. After it processes records, it calls AcknowledgeQueueRecords so the queue does not deliver them again.

Queues are supported only on data streams in on-demand capacity mode.

Creating a queue does not change how producers write to the stream, and it does not change how existing stream consumers read from it. A queue counts as a registered consumer on the stream and shares the stream's registered consumer limit with enhanced fan-out consumers: 20 on On-demand Standard and 50 on On-demand Advantage.

Use StartingPosition to set the position in the stream where delivery begins. The default is LATEST.

CreateQueue is an asynchronous operation. Upon receiving a CreateQueue request, Amazon Kinesis Data Streams immediately returns a queue description with a QueueStatus of CREATING. After the queue is created, Kinesis Data Streams sets the QueueStatus to ACTIVE. You can begin receiving records after the queue is ACTIVE. Use DescribeQueue to check the status of the queue.

Each queue has built-in dead-letter handling. When a record has been received MaxReceiveCount times without being acknowledged, it becomes a dead-letter record, and ReceiveQueueRecords no longer returns it. You work with dead-letter records through a separate set of operations that use the same queue ARN: ReceiveDeadLetterQueueRecords, AcknowledgeDeadLetterQueueRecords, UpdateDeadLetterQueueRecordsVisibility, and RestoreDeadLetterQueueRecords.

Dead-letter handling is enabled by default, with a MaxReceiveCount of 6. To use a different value, or to turn dead-letter handling off, specify DeadLetterConfiguration in QueueAttributes.

Request Syntax

{ "QueueAttributes": { "DeadLetterConfiguration": { "MaxReceiveCount": number, "TargetType": "string" }, "VisibilityTimeoutSeconds": number }, "QueueName": "string", "StreamConfigurationList": [ { "StartingPosition": { "Timestamp": number, "Type": "string" }, "StreamARN": "string" } ], "Tags": { "string" : "string" } }

Request Parameters

The request accepts the following data in JSON format.

QueueAttributes

The configuration attributes for the queue, including its visibility timeout and its dead-letter handling configuration.

Type: QueueAttributes object

Required: No

QueueName

A name for the queue. The name is scoped to the AWS account and Region used by the request, so two queues in different accounts, or in the same account and different Regions, can have the same name.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [a-zA-Z0-9_.-]+

Required: Yes

StreamConfigurationList

The data stream the queue delivers records from, and the position in that stream where delivery begins. The list must contain exactly one entry, because a queue delivers records from a single data stream.

Type: Array of QueueStreamConfiguration objects

Array Members: Fixed number of 1 item.

Required: Yes

Tags

A set of up to 50 key-value pairs to apply to the queue. You can also add, change, and remove tags after the queue is created with TagResource and UntagResource.

Type: String to string map

Map Entries: Maximum number of 200 items.

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Value Length Constraints: Minimum length of 0. Maximum length of 256.

Required: No

Response Syntax

{ "QueueDescription": { "QueueARN": "string", "QueueAttributes": { "DeadLetterConfiguration": { "MaxReceiveCount": number, "TargetType": "string" }, "VisibilityTimeoutSeconds": number }, "QueueCreationTimestamp": number, "QueueName": "string", "QueueStatus": "string", "StreamConfigurationList": [ { "StartingPosition": { "Timestamp": number, "Type": "string" }, "StreamARN": "string" } ] } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

QueueDescription

A description of the queue that was created.

Type: QueueDescription object

Errors

For information about the errors that are common to all actions, see Common Error Types.

AccessDeniedException

Specifies that you do not have the permissions required to perform this operation.

HTTP Status Code: 400

InternalFailureException

The processing of the request failed because of an unknown error, exception, or failure.

HTTP Status Code: 500

InvalidArgumentException

A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.

message

A message that provides information about the error.

HTTP Status Code: 400

LimitExceededException

The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.

message

A message that provides information about the error.

HTTP Status Code: 400

ResourceInUseException

The resource is not available for this operation. For successful operation, the resource must be in the ACTIVE state.

message

A message that provides information about the error.

HTTP Status Code: 400

ResourceNotFoundException

The requested resource could not be found. The stream might not be specified correctly.

message

A message that provides information about the error.

HTTP Status Code: 400

ValidationException

The request failed validation. For example, a parameter value is not valid, a combination of parameters is not supported, or the operation is not supported for the stream's capacity mode. The error message describes the specific reason.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: