AWS Java SDK: AbortedException on call to AmazonSQSClient.receiveMessage

前端 未结 1 1883
一整个雨季
一整个雨季 2021-01-17 22:51

We are trying to read from an Amazon SQS Queue from a Java program running on an EC2 instance. On occasion, we get a com.amazonaws.AbortedException. Our code lo

相关标签:
1条回答
  • 2021-01-17 23:06

    Though the javadoc on AbortedException is sparse, it is a subclass of AmazonClientException & RuntimeException (which do not have to be declared). Also, the AWS Exception handling docs says this:

    AmazonClientException indicates that a problem occurred inside the Java client code, either while trying to send a request to AWS or while trying to parse a response from AWS. An AmazonClientException is generally more severe than an AmazonServiceException, and indicates a major problem that is preventing the client from making service calls to AWS services. For example, the AWS SDK for Java throws an AmazonClientException if no network connection is available when you try to call an operation on one of the clients.

    AbortedException is generally thrown when the SDK handles an InterruptedException (ie: the thread was signalled to stop doing work). For your purposes though, you probably just want to retry the operation.

    (If you're the one doing the explicit Thread.interrupt to cause this though, then it's up to you on how you want to proceed - either treat it as a signal to stop work, or just retry the operation)

    0 讨论(0)
提交回复
热议问题