Skip to content

create_queue

create_queue(
    queue_name: QueueName,
    stream_configuration_list: QueueStreamConfigurationList,
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    queue_attributes: Optional[QueueAttributes] = None,
    tags: Optional[TagMap] = None,
) -> CreateQueueOutput

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.

Parameters:

  • queue_name (QueueName) –

    A name for the queue. The name is scoped to the Amazon Web Services 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.

  • stream_configuration_list (QueueStreamConfigurationList) –

    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.

  • queue_attributes (Optional[QueueAttributes], default: None ) –

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

  • tags (Optional[TagMap], default: None ) –

    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.

Raises:

  • AccessDeniedException –

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

  • InternalFailureException –

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

  • InvalidArgumentException –

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

  • LimitExceededException –

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

  • ResourceInUseException –

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

  • ResourceNotFoundException –

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

  • 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.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_kinesis/_services/kinesis.py
def create_queue(
    self,
    queue_name: "capo_kinesis.types.queue_name.QueueName",
    stream_configuration_list: "capo_kinesis.types.queue_stream_configuration_list.QueueStreamConfigurationList",
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    queue_attributes: Optional[
        "capo_kinesis.types.queue_attributes.QueueAttributes"
    ] = None,
    tags: Optional["capo_kinesis.types.tag_map.TagMap"] = None,
) -> "capo_kinesis.types.create_queue_output.CreateQueueOutput":
    """<p>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.</p> <p>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.</p> <p>Your queue consumer calls <a>ReceiveQueueRecords</a> to receive up to 10 records at a time. After it processes records, it calls <a>AcknowledgeQueueRecords</a> so the queue does not deliver them again.</p> <p>Queues are supported only on data streams in on-demand capacity mode.</p> <p>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.</p> <p>Use <code>StartingPosition</code> to set the position in the stream where delivery begins. The default is <code>LATEST</code>.</p> <p> <code>CreateQueue</code> is an asynchronous operation. Upon receiving a <code>CreateQueue</code> request, Amazon Kinesis Data Streams immediately returns a queue description with a <code>QueueStatus</code> of <code>CREATING</code>. After the queue is created, Kinesis Data Streams sets the <code>QueueStatus</code> to <code>ACTIVE</code>. You can begin receiving records after the queue is <code>ACTIVE</code>. Use <a>DescribeQueue</a> to check the status of the queue.</p> <p>Each queue has built-in dead-letter handling. When a record has been received <code>MaxReceiveCount</code> times without being acknowledged, it becomes a dead-letter record, and <a>ReceiveQueueRecords</a> no longer returns it. You work with dead-letter records through a separate set of operations that use the same queue ARN: <a>ReceiveDeadLetterQueueRecords</a>, <a>AcknowledgeDeadLetterQueueRecords</a>, <a>UpdateDeadLetterQueueRecordsVisibility</a>, and <a>RestoreDeadLetterQueueRecords</a>.</p> <p>Dead-letter handling is enabled by default, with a <code>MaxReceiveCount</code> of 6. To use a different value, or to turn dead-letter handling off, specify <code>DeadLetterConfiguration</code> in <code>QueueAttributes</code>.</p>

    Args:
        queue_name: <p>A name for the queue. The name is scoped to the Amazon Web Services 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.</p>
        stream_configuration_list: <p>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.</p>
        queue_attributes: <p>The configuration attributes for the queue, including its visibility timeout and its dead-letter handling configuration.</p>
        tags: <p>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 <a>TagResource</a> and <a>UntagResource</a>.</p>

    Raises:
        capo_kinesis.errors.access_denied_exception.AccessDeniedException: <p>Specifies that you do not have the permissions required to perform this operation.</p>
        capo_kinesis.errors.internal_failure_exception.InternalFailureException: <p>The processing of the request failed because of an unknown error, exception, or failure.</p>
        capo_kinesis.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.</p>
        capo_kinesis.errors.limit_exceeded_exception.LimitExceededException: <p>The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed. </p>
        capo_kinesis.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is not available for this operation. For successful operation, the resource must be in the <code>ACTIVE</code> state.</p>
        capo_kinesis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found. The stream might not be specified correctly.</p>
        capo_kinesis.errors.validation_exception.ValidationException: <p>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.</p>
        capo_kinesis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_kinesis.types.create_queue_input.CreateQueueInput]",
    ) -> OperationResponse[
        "capo_kinesis.types.create_queue_output.CreateQueueOutput"
    ]:
        import capo_kinesis._operations.kinesis_20131202.create_queue

        output, http_response = (
            capo_kinesis._operations.kinesis_20131202.create_queue.create_queue(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateQueue")
    )
    input_: capo_kinesis.types.create_queue_input.CreateQueueInput = {
        "queue_name": queue_name,
        "stream_configuration_list": stream_configuration_list,
    }
    if queue_attributes is not None:
        input_["queue_attributes"] = queue_attributes
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output