This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 f21be8710d77 CAMEL-28028: camel-aws2-ses - the producer health check
reports DOWN on an AWS service error (#31260)
f21be8710d77 is described below
commit f21be8710d77811fd3dd42666ea0d23442b70ddd
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Dec 4 07:44:25 2026 +0100
CAMEL-28028: camel-aws2-ses - the producer health check reports DOWN on an
AWS service error (#31260)
The AwsServiceException branch of Ses2ProducerHealthCheck set down() but
did not return, so
execution fell through to builder.up() and SES throttling, an unreachable
endpoint or rejected
credentials were all reported as healthy. Add the missing return, and the
status and error code
details that the sibling components already add.
Also document that the GetSendStatistics probe needs the
ses:GetSendStatistics permission, which
ses:SendEmail and ses:SendRawEmail do not imply, that the opt-out is the
component option
healthCheckProducerEnabled, and add an upgrade guide entry.
Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Andrea Cosentino <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../camel/catalog/docs/aws2-ses-component.adoc | 13 +++++
.../src/main/docs/aws2-ses-component.adoc | 13 +++++
.../aws2/ses/Ses2ProducerHealthCheck.java | 9 ++-
...es2ProducerHealthCheckServiceExceptionTest.java | 68 ++++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc | 9 +++
5 files changed, 111 insertions(+), 1 deletion(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ses-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ses-component.adoc
index 5c8d51a11108..0c721575725a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ses-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ses-component.adoc
@@ -109,6 +109,19 @@ YAML::
The `#client` refers to a `SesClient` in the Registry.
+=== Producer health check
+
+When the producer health check is enabled, it probes SES with
`GetSendStatistics`. That call needs the
+`ses:GetSendStatistics` permission, which is *not* implied by `ses:SendEmail`
and `ses:SendRawEmail`. With a policy that
+only grants the two sending actions, the check reports DOWN with an
`AccessDenied` error although the route sends mail
+correctly. Either grant `ses:GetSendStatistics` as well, or disable the check
on the component, for example with
+`camel.component.aws2-ses.healthCheckProducerEnabled=false`.
`healthCheckProducerEnabled` is a component option, not
+an endpoint option.
+
+Any other SES service error on the probe, throttling included, reports DOWN as
well. Each SES endpoint runs its own
+check, and `GetSendStatistics` has a low rate limit. A deployment with many
SES endpoints can reach that limit from the
+probes alone. If that happens, disable the check as above.
+
=== Message body
The producer sends the message body as follows:
diff --git
a/components/camel-aws/camel-aws2-ses/src/main/docs/aws2-ses-component.adoc
b/components/camel-aws/camel-aws2-ses/src/main/docs/aws2-ses-component.adoc
index 5c8d51a11108..0c721575725a 100644
--- a/components/camel-aws/camel-aws2-ses/src/main/docs/aws2-ses-component.adoc
+++ b/components/camel-aws/camel-aws2-ses/src/main/docs/aws2-ses-component.adoc
@@ -109,6 +109,19 @@ YAML::
The `#client` refers to a `SesClient` in the Registry.
+=== Producer health check
+
+When the producer health check is enabled, it probes SES with
`GetSendStatistics`. That call needs the
+`ses:GetSendStatistics` permission, which is *not* implied by `ses:SendEmail`
and `ses:SendRawEmail`. With a policy that
+only grants the two sending actions, the check reports DOWN with an
`AccessDenied` error although the route sends mail
+correctly. Either grant `ses:GetSendStatistics` as well, or disable the check
on the component, for example with
+`camel.component.aws2-ses.healthCheckProducerEnabled=false`.
`healthCheckProducerEnabled` is a component option, not
+an endpoint option.
+
+Any other SES service error on the probe, throttling included, reports DOWN as
well. Each SES endpoint runs its own
+check, and `GetSendStatistics` has a low rate limit. A deployment with many
SES endpoints can reach that limit from the
+probes alone. If that happens, disable the check as above.
+
=== Message body
The producer sends the message body as follows:
diff --git
a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheck.java
b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheck.java
index 7ec99a76a96a..acebedbedb6c 100644
---
a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheck.java
+++
b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheck.java
@@ -20,6 +20,7 @@ import java.util.Map;
import org.apache.camel.health.HealthCheckResultBuilder;
import org.apache.camel.impl.health.AbstractHealthCheck;
+import org.apache.camel.util.ObjectHelper;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.ses.SesClient;
@@ -47,14 +48,20 @@ public class Ses2ProducerHealthCheck extends
AbstractHealthCheck {
} 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()) &&
ObjectHelper.isNotEmpty(e.awsErrorDetails().errorCode())) {
+ builder.detail(SERVICE_ERROR_CODE,
e.awsErrorDetails().errorCode());
+ }
builder.down();
+ return;
} catch (Exception e) {
builder.error(e);
builder.down();
return;
}
builder.up();
-
}
}
diff --git
a/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheckServiceExceptionTest.java
b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheckServiceExceptionTest.java
new file mode 100644
index 000000000000..429e58da93ee
--- /dev/null
+++
b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/Ses2ProducerHealthCheckServiceExceptionTest.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.ses;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.impl.health.AbstractHealthCheck;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.awscore.exception.AwsErrorDetails;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.services.ses.model.GetSendStatisticsResponse;
+
+/**
+ * The producer health check must report DOWN when SES answers with a service
error, and must carry the status and error
+ * code as details.
+ */
+public class Ses2ProducerHealthCheckServiceExceptionTest extends
CamelTestSupport {
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext context = super.createCamelContext();
+ context.getRegistry().bind("failingClient", new
ThrottlingSesClientMock());
+ return context;
+ }
+
+ @Test
+ public void shouldBeDownOnAwsServiceException() throws Exception {
+ Ses2Endpoint endpoint = context.getEndpoint(
+
"aws2-ses://[email protected]?region=eu-west-1&amazonSESClient=#failingClient",
Ses2Endpoint.class);
+ endpoint.start();
+
+ HealthCheck.Result result = new Ses2ProducerHealthCheck(endpoint,
"test").call();
+
+ Assertions.assertEquals(HealthCheck.State.DOWN, result.getState());
+ Assertions.assertTrue(result.getMessage().orElse("").contains("Maximum
sending rate exceeded"),
+ "the health check message carries the SES error message");
+ Assertions.assertEquals(429,
result.getDetails().get(AbstractHealthCheck.SERVICE_STATUS_CODE));
+ Assertions.assertEquals("ThrottlingException",
result.getDetails().get(AbstractHealthCheck.SERVICE_ERROR_CODE));
+ }
+
+ private static class ThrottlingSesClientMock extends AmazonSESClientMock {
+
+ @Override
+ public GetSendStatisticsResponse getSendStatistics() {
+ throw AwsServiceException.builder()
+ .message("Maximum sending rate exceeded")
+ .statusCode(429)
+
.awsErrorDetails(AwsErrorDetails.builder().errorCode("ThrottlingException").build())
+ .build();
+ }
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index 855a4459420e..fb76dc364b54 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -357,6 +357,15 @@ Translate, so a name that does not exist now fails the
request with a `ResourceN
A header of another type, such as an `Integer`, now fails the exchange with an
`IllegalArgumentException` instead of
being ignored.
+=== camel-aws2-ses - the producer health check reports DOWN on an AWS service
error
+
+The producer health check of `aws2-ses` now reports DOWN when the
`GetSendStatistics` probe fails with an AWS service
+error, such as throttling, an `AccessDenied` error or rejected credentials.
Before, that branch fell through and the
+check reported UP, so a least-privilege policy that grants only
`ses:SendEmail` and `ses:SendRawEmail` showed a healthy
+producer. A deployment with such a policy that has the producer health check
enabled now sees DOWN after upgrading.
+Either grant `ses:GetSendStatistics` as well, or disable the check with the
component option
+`camel.component.aws2-ses.healthCheckProducerEnabled=false`.
+
=== camel-robotframework - obsolete options suppressed, variables passthrough
fixed
Five endpoint options that were forwarded to Robot Framework but no longer
exist in