Class AmazonServiceExceptionTransformer

java.lang.Object
com.amazonaws.services.dynamodbv2.streamsadapter.util.AmazonServiceExceptionTransformer

public final class AmazonServiceExceptionTransformer extends Object

This class transforms an Amazon DynamoDB Streams AmazonServiceException into a compatible Amazon Kinesis AmazonServiceException.

Applicable API calls:

  • Field Details

    • DYNAMODB_STREAMS_THROTTLING_EXCEPTION_ERROR_CODE

      public static final String DYNAMODB_STREAMS_THROTTLING_EXCEPTION_ERROR_CODE
      Error message used for ThrottlingException by the Amazon DynamoDB Streams service.
      See Also:
    • EMPTY_STRING

      public static final String EMPTY_STRING
      Empty String used when an Exception requires an error message, but none is supplied.
      See Also:
    • KINESIS_INTERNAL_ERROR_MESSAGE

      public static final String KINESIS_INTERNAL_ERROR_MESSAGE
      Error message used for InternalFailure by the Amazon Kinesis service.
      See Also:
    • KINESIS_VALIDATION_ERROR_MESSAGE

      public static final String KINESIS_VALIDATION_ERROR_MESSAGE
      Error message used for ValidationError by the Amazon Kinesis service.
      See Also:
  • Method Details

    • transformDynamoDBStreamsToKinesisDescribeStream

      public static software.amazon.awssdk.awscore.exception.AwsServiceException transformDynamoDBStreamsToKinesisDescribeStream(software.amazon.awssdk.awscore.exception.AwsServiceException ase)
      Transforms Amazon DynamoDB Streams exceptions to compatible Amazon Kinesis exceptions for the DescribeStream API.

      The following transformations are applied:
      (1) InternalServerError
      Amazon DynamoDB Streams: InternalServerErrorException
      Amazon Kinesis: com.amazonaws.AmazonServiceException
      Notes: SDK relies on the 500 series StatusCode to identify that the issue was service side

      (2) ResourceNotFound
      Amazon DynamoDB Streams: ResourceNotFoundException
      Amazon Kinesis: ResourceNotFoundException
      Notes: N/A

      (2) ThrottlingException
      Amazon DynamoDB Streams: AwsServiceException with ErrorCode "ThrottlingException"
      Amazon Kinesis: LimitExceededException
      Notes: N/A

      Parameters:
      ase - The Amazon DynamoDB Streams exception thrown by a DescribeStream call
      Returns:
      A compatible Amazon Kinesis DescribeStream exception
    • transformDynamoDBStreamsToKinesisGetRecords

      public static software.amazon.awssdk.awscore.exception.AwsServiceException transformDynamoDBStreamsToKinesisGetRecords(software.amazon.awssdk.awscore.exception.AwsServiceException ase, AmazonDynamoDBStreamsAdapterClient.SkipRecordsBehavior skipRecordsBehavior)
      Transforms Amazon DynamoDB Streams exceptions to compatible Amazon Kinesis exceptions for the GetRecords API.

      The following transformations are applied:
      (1) ExpiredIterator
      Amazon DynamoDB Streams: ExpiredIteratorException
      Amazon Kinesis: ExpiredIteratorException
      Notes: N/A

      (2) InternalServerError
      Amazon DynamoDB Streams: InternalServerErrorException
      Amazon Kinesis: AwsServiceException
      Notes: SDK relies on the 500 series StatusCode to identify that the issue was service side

      (3) LimitExceeded
      Amazon DynamoDB Streams: LimitExceededException
      Amazon Kinesis: ProvisionedThroughputExceededException
      Notes: N/A

      (4) ResourceNotFound
      Amazon DynamoDB Streams: ResourceNotFoundException
      Amazon Kinesis: ResourceNotFoundException
      Notes: N/A

      (5) ThrottlingException
      Amazon DynamoDB Streams: AwsServiceException with ErrorCode "ThrottlingException"
      Amazon Kinesis: ProvisionedThroughputExceededException
      Notes: N/A
      (6) TrimmedDataAccess
      Amazon DynamoDB Streams: TrimmedDataAccessException
      Amazon Kinesis: N/A
      Notes: FIXME Amazon Kinesis does not communicate trimmed data; the service retrieves the oldest available records for the shard and returns those as if no trimming occurred. Because no context information about the shardId or streamId is available in the GetRecords request, the adapter relies on the user attempting to get a fresh shard iterator using the GetShardIterator API when an ExpiredIteratorException is thrown. If data loss is unacceptable, an UnableToReadMoreRecordsException is thrown.

      Parameters:
      ase - The Amazon DynamoDB Streams exception thrown by a GetRecords call
      skipRecordsBehavior - The AmazonDynamoDBStreamsAdapterClient.SkipRecordsBehavior for the adapter
      Returns:
      A compatible Amazon Kinesis GetRecords exception
    • transformDynamoDBStreamsToKinesisGetShardIterator

      public static software.amazon.awssdk.awscore.exception.AwsServiceException transformDynamoDBStreamsToKinesisGetShardIterator(software.amazon.awssdk.awscore.exception.AwsServiceException ase, AmazonDynamoDBStreamsAdapterClient.SkipRecordsBehavior skipRecordsBehavior)
      Transforms Amazon DynamoDB Streams exceptions to compatible Amazon Kinesis exceptions for the GetShardIterator API.

      The following transformations are applied:
      (1) InternalServerError
      Amazon DynamoDB Streams: InternalServerErrorException
      Amazon Kinesis: AwsServiceException
      Notes: SDK relies on the 500 series StatusCode to identify that the issue was service side

      (2) ResourceNotFound
      Amazon DynamoDB Streams: ResourceNotFoundException
      Amazon Kinesis: ResourceNotFoundException
      Notes: Amazon Kinesis does not differentiate TrimmedData and ResourceNotFound. In the case that data loss is not acceptable, the adapter throws an UnableToReadMoreRecordsException

      (3) ThrottlingException
      Amazon DynamoDB Streams: AwsServiceException with ErrorCode "ThrottlingException"
      Amazon Kinesis: ProvisionedThroughputExceededException
      Notes: N/A
      (4) TrimmedDataAccess
      Amazon DynamoDB Streams: TrimmedDataAccessException
      Amazon Kinesis: N/A
      Notes: FIXME Amazon Kinesis does not communicate trimmed data; the service returns a valid shard iterator for the oldest available records for the specified shard as if no trimming occurred. If data loss is acceptable, the adapter mimics this behavior by intercepting the exception and retrieving a shard iterator for TRIM_HORIZON. If data loss is unacceptable, an UnableToReadMoreRecordsException is thrown.

      Parameters:
      ase - The Amazon DynamoDB Streams exception thrown by a GetRecords call
      skipRecordsBehavior - The AmazonDynamoDBStreamsAdapterClient.SkipRecordsBehavior for the adapter
      Returns:
      A compatible Amazon Kinesis GetRecords exception
    • transformDynamoDBStreamsToKinesisListStreams

      public static software.amazon.awssdk.awscore.exception.AwsServiceException transformDynamoDBStreamsToKinesisListStreams(software.amazon.awssdk.awscore.exception.AwsServiceException ase)
      Transforms Amazon DynamoDB Streams exceptions to compatible Amazon Kinesis exceptions for the ListStreams API.

      The following transformations are applied:
      (1) InternalServerError
      Amazon DynamoDB Streams: InternalServerErrorException
      Amazon Kinesis: AwsServiceException
      Notes: SDK relies on the 500 series StatusCode to identify that the issue was service side

      (2) ResourceNotFound
      Amazon DynamoDB Streams: ResourceNotFoundException
      Amazon Kinesis: N/A
      Notes: A compatible transformation is to an AmazonServiceException with a 400 series StatusCode

      (3) ThrottlingException
      Amazon DynamoDB Streams: AwsServiceException with ErrorCode "ThrottlingException"
      Amazon Kinesis: LimitExceededException
      Notes: N/A

      Parameters:
      ase - The Amazon DynamoDB Streams exception thrown by a ListStreams call
      Returns:
      A compatible Amazon Kinesis ListStreams exception