You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/10/24 10:23:20 UTC
[camel] branch main updated: CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS SQS
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e5909193222 CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS SQS
e5909193222 is described below
commit e5909193222dd0f764b6f7177ce2e36c7c5961aa
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Oct 24 11:10:34 2022 +0200
CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS SQS
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../camel/component/aws2/sqs/Sqs2ConsumerHealthCheck.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2ConsumerHealthCheck.java b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2ConsumerHealthCheck.java
index 628978a9361..dbbc50cc7db 100644
--- a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2ConsumerHealthCheck.java
+++ b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2ConsumerHealthCheck.java
@@ -23,7 +23,7 @@ import org.apache.camel.impl.health.AbstractHealthCheck;
import org.apache.camel.util.ObjectHelper;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.core.exception.SdkClientException;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sqs.SqsClient;
import software.amazon.awssdk.services.sqs.SqsClientBuilder;
@@ -69,9 +69,15 @@ public class Sqs2ConsumerHealthCheck extends AbstractHealthCheck {
client = clientBuilder.region(Region.of(configuration.getRegion())).build();
}
client.listQueues();
- } catch (SdkClientException e) {
+ } catch (AwsServiceException e) {
builder.message(e.getMessage());
builder.error(e);
+ if (ObjectHelper.isNotEmpty(e.statusCode())) {
+ builder.detail(SERVICE_STATUS_CODE, e.statusCode());
+ }
+ if (ObjectHelper.isNotEmpty(e.awsErrorDetails().errorCode())) {
+ builder.detail(SERVICE_ERROR_CODE, e.awsErrorDetails().errorCode());
+ }
builder.down();
return;