Skip to content

receive_dead_letter_queue_records

receive_dead_letter_queue_records(
    queue_arn: QueueARN,
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    limit: Optional[ReceiveQueueRecordsInputLimit] = None,
    wait_time_seconds: Optional[ReceiveQueueRecordsWaitTimeSeconds] = None,
    visibility_timeout_seconds: Optional[VisibilityTimeoutSeconds] = None,
) -> ReceiveDeadLetterQueueRecordsOutput

Receives up to 10 dead-letter records from the specified 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, which usually means your queue consumer could not process it. The dead-letter record stays in the same queue, and ReceiveQueueRecords no longer returns it.

Dead-letter records carry the same data and partition key as when they were first delivered, and are returned with a receipt handle. Use the receipt handle to acknowledge the record with AcknowledgeDeadLetterQueueRecords, which discards it, to change its visibility with UpdateDeadLetterQueueRecordsVisibility, or to restore it with RestoreDeadLetterQueueRecords, which returns it to the normal receive path so that ReceiveQueueRecords can return it again.

Use this operation to inspect the records your queue consumer could not process, so you can correct the cause and then either acknowledge or restore them.

A queue delivers dead-letter records while it is in the ACTIVE state.

Parameters:

  • queue_arn (QueueARN) –

    The ARN of the queue whose dead-letter records are received.

  • limit (Optional[ReceiveQueueRecordsInputLimit], default: None ) –

    The maximum number of records to return. The queue never returns more dead-letter records than this value, and might return fewer. The default is 10.

  • wait_time_seconds (Optional[ReceiveQueueRecordsWaitTimeSeconds], default: None ) –

    The duration, in seconds, that the call waits for a record to become visible before returning. The default is 9.

  • visibility_timeout_seconds (Optional[VisibilityTimeoutSeconds], default: None ) –

    The duration, in seconds, that the records returned by this request are in flight and not visible to any consumer instance. If you do not specify this value, the queue's visibility timeout is used.

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.

  • KMSAccessDeniedException –

    The ciphertext references a key that doesn't exist or that you don't have access to.

  • KMSDisabledException –

    The request was rejected because the specified KMS key isn't enabled.

  • KMSInvalidStateException –

    The request was rejected because the state of the specified resource isn't valid for this request. For more information, see How Key State Affects Use of a Customer Master Key in the Amazon Web Services Key Management Service Developer Guide.

  • KMSNotFoundException –

    The request was rejected because the specified entity or resource can't be found.

  • KMSOptInRequired –

    The Amazon Web Services access key ID needs a subscription for the service.

  • KMSThrottlingException –

    The request was denied due to request throttling. For more information about throttling, see Limits in the Amazon Web Services Key Management Service Developer Guide.

  • ResourceNotFoundException –

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

  • ThrottlingException –

    The request was denied because the request rate is too high. Reduce the frequency of your requests, and retry them with exponential backoff.

  • UnknownServiceError –

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

Source code in docs_src/capo_kinesis/_services/kinesis.py
def receive_dead_letter_queue_records(
    self,
    queue_arn: "capo_kinesis.types.queue_arn.QueueARN",
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    limit: Optional[
        "capo_kinesis.types.receive_queue_records_input_limit.ReceiveQueueRecordsInputLimit"
    ] = None,
    wait_time_seconds: Optional[
        "capo_kinesis.types.receive_queue_records_wait_time_seconds.ReceiveQueueRecordsWaitTimeSeconds"
    ] = None,
    visibility_timeout_seconds: Optional[
        "capo_kinesis.types.visibility_timeout_seconds.VisibilityTimeoutSeconds"
    ] = None,
) -> "capo_kinesis.types.receive_dead_letter_queue_records_output.ReceiveDeadLetterQueueRecordsOutput":
    """<p>Receives up to 10 dead-letter records from the specified queue. 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, which usually means your queue consumer could not process it. The dead-letter record stays in the same queue, and <a>ReceiveQueueRecords</a> no longer returns it.</p> <p>Dead-letter records carry the same data and partition key as when they were first delivered, and are returned with a receipt handle. Use the receipt handle to acknowledge the record with <a>AcknowledgeDeadLetterQueueRecords</a>, which discards it, to change its visibility with <a>UpdateDeadLetterQueueRecordsVisibility</a>, or to restore it with <a>RestoreDeadLetterQueueRecords</a>, which returns it to the normal receive path so that <a>ReceiveQueueRecords</a> can return it again.</p> <p>Use this operation to inspect the records your queue consumer could not process, so you can correct the cause and then either acknowledge or restore them.</p> <p>A queue delivers dead-letter records while it is in the <code>ACTIVE</code> state.</p>

    Args:
        queue_arn: <p>The ARN of the queue whose dead-letter records are received.</p>
        limit: <p>The maximum number of records to return. The queue never returns more dead-letter records than this value, and might return fewer. The default is 10.</p>
        wait_time_seconds: <p>The duration, in seconds, that the call waits for a record to become visible before returning. The default is 9.</p>
        visibility_timeout_seconds: <p>The duration, in seconds, that the records returned by this request are in flight and not visible to any consumer instance. If you do not specify this value, the queue's visibility timeout is used.</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.kms_access_denied_exception.KMSAccessDeniedException: <p>The ciphertext references a key that doesn't exist or that you don't have access to.</p>
        capo_kinesis.errors.kms_disabled_exception.KMSDisabledException: <p>The request was rejected because the specified KMS key isn't enabled.</p>
        capo_kinesis.errors.kms_invalid_state_exception.KMSInvalidStateException: <p>The request was rejected because the state of the specified resource isn't valid for this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">How Key State Affects Use of a Customer Master Key</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
        capo_kinesis.errors.kms_not_found_exception.KMSNotFoundException: <p>The request was rejected because the specified entity or resource can't be found.</p>
        capo_kinesis.errors.kms_opt_in_required.KMSOptInRequired: <p>The Amazon Web Services access key ID needs a subscription for the service.</p>
        capo_kinesis.errors.kms_throttling_exception.KMSThrottlingException: <p>The request was denied due to request throttling. For more information about throttling, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/limits.html#requests-per-second">Limits</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</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.throttling_exception.ThrottlingException: <p>The request was denied because the request rate is too high. Reduce the frequency of your requests, and retry them with exponential backoff.</p>
        capo_kinesis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_kinesis.types.receive_dead_letter_queue_records_input.ReceiveDeadLetterQueueRecordsInput]",
    ) -> OperationResponse[
        "capo_kinesis.types.receive_dead_letter_queue_records_output.ReceiveDeadLetterQueueRecordsOutput"
    ]:
        import capo_kinesis._operations.kinesis_20131202.receive_dead_letter_queue_records

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ReceiveDeadLetterQueueRecords")
    )
    input_: capo_kinesis.types.receive_dead_letter_queue_records_input.ReceiveDeadLetterQueueRecordsInput = {
        "queue_arn": queue_arn
    }
    if limit is not None:
        input_["limit"] = limit
    if wait_time_seconds is not None:
        input_["wait_time_seconds"] = wait_time_seconds
    if visibility_timeout_seconds is not None:
        input_["visibility_timeout_seconds"] = visibility_timeout_seconds

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