You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/28 08:22:35 UTC
[camel] 07/13: CAMEL-19645: camel-aws - producer health check
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch hc-producer
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3f1025ca572f46b1e972ec745ff621d06d090fd9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 28 10:04:10 2023 +0200
CAMEL-19645: camel-aws - producer health check
---
.../aws2/lambda/Lambda2ComponentConfigurer.java | 18 +++++++++++++
.../camel/component/aws2/lambda/aws2-lambda.json | 13 +++++----
.../component/aws2/lambda/Lambda2Component.java | 5 ++--
.../component/aws2/lambda/Lambda2Endpoint.java | 24 ++++-------------
.../component/aws2/lambda/Lambda2Producer.java | 31 ++++++++++++++++++++++
...hCheck.java => Lambda2ProducerHealthCheck.java} | 6 ++---
...ambda2ProducerHealthCheckProfileCredsTest.java} | 13 ++-------
...Lambda2ProducerHealthCheckStaticCredsTest.java} | 13 ++-------
8 files changed, 72 insertions(+), 51 deletions(-)
diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java
index 608a02e5c03..cc5102f2321 100644
--- a/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java
@@ -35,6 +35,12 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem
case "awslambdaclient":
case "awsLambdaClient": getOrCreateConfiguration(target).setAwsLambdaClient(property(camelContext, software.amazon.awssdk.services.lambda.LambdaClient.class, value)); return true;
case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.aws2.lambda.Lambda2Configuration.class, value)); return true;
+ case "healthcheckconsumerenabled":
+ case "healthCheckConsumerEnabled": target.setHealthCheckConsumerEnabled(property(camelContext, boolean.class, value)); return true;
+ case "healthcheckenabled":
+ case "healthCheckEnabled": target.setHealthCheckEnabled(property(camelContext, boolean.class, value)); return true;
+ case "healthcheckproducerenabled":
+ case "healthCheckProducerEnabled": target.setHealthCheckProducerEnabled(property(camelContext, boolean.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "operation": getOrCreateConfiguration(target).setOperation(property(camelContext, org.apache.camel.component.aws2.lambda.Lambda2Operations.class, value)); return true;
@@ -80,6 +86,12 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem
case "awslambdaclient":
case "awsLambdaClient": return software.amazon.awssdk.services.lambda.LambdaClient.class;
case "configuration": return org.apache.camel.component.aws2.lambda.Lambda2Configuration.class;
+ case "healthcheckconsumerenabled":
+ case "healthCheckConsumerEnabled": return boolean.class;
+ case "healthcheckenabled":
+ case "healthCheckEnabled": return boolean.class;
+ case "healthcheckproducerenabled":
+ case "healthCheckProducerEnabled": return boolean.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
case "operation": return org.apache.camel.component.aws2.lambda.Lambda2Operations.class;
@@ -121,6 +133,12 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem
case "awslambdaclient":
case "awsLambdaClient": return getOrCreateConfiguration(target).getAwsLambdaClient();
case "configuration": return target.getConfiguration();
+ case "healthcheckconsumerenabled":
+ case "healthCheckConsumerEnabled": return target.isHealthCheckConsumerEnabled();
+ case "healthcheckenabled":
+ case "healthCheckEnabled": return target.isHealthCheckEnabled();
+ case "healthcheckproducerenabled":
+ case "healthCheckProducerEnabled": return target.isHealthCheckProducerEnabled();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "operation": return getOrCreateConfiguration(target).getOperation();
diff --git a/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json b/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json
index 9be0f5a6cda..bfd9f891c42 100644
--- a/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json
+++ b/components/camel-aws/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json
@@ -35,11 +35,14 @@
"useProfileCredentialsProvider": { "index": 10, "kind": "property", "displayName": "Use Profile Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Set whether the Lambda client should expect to load c [...]
"autowiredEnabled": { "index": 11, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
"awsLambdaClient": { "index": 12, "kind": "property", "displayName": "Aws Lambda Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.lambda.LambdaClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To use a existing configured Aws [...]
- "proxyHost": { "index": 13, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Lambda client" },
- "proxyPort": { "index": 14, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Lambda client" },
- "proxyProtocol": { "index": 15, "kind": "property", "displayName": "Proxy Protocol", "group": "proxy", "label": "proxy", "required": false, "type": "object", "javaType": "software.amazon.awssdk.core.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy protocol [...]
- "accessKey": { "index": 16, "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
- "secretKey": { "index": 17, "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
+ "healthCheckConsumerEnabled": { "index": 13, "kind": "property", "displayName": "Health Check Consumer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all consumer based health checks from this component" },
+ "healthCheckEnabled": { "index": 14, "kind": "property", "displayName": "Health Check Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all health checks from this component" },
+ "healthCheckProducerEnabled": { "index": 15, "kind": "property", "displayName": "Health Check Producer Enabled", "group": "health", "label": "health", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Used for enabling or disabling all producer based health checks from this component" },
+ "proxyHost": { "index": 16, "kind": "property", "displayName": "Proxy Host", "group": "proxy", "label": "proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Lambda client" },
+ "proxyPort": { "index": 17, "kind": "property", "displayName": "Proxy Port", "group": "proxy", "label": "proxy", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Lambda client" },
+ "proxyProtocol": { "index": 18, "kind": "property", "displayName": "Proxy Protocol", "group": "proxy", "label": "proxy", "required": false, "type": "object", "javaType": "software.amazon.awssdk.core.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To define a proxy protocol [...]
+ "accessKey": { "index": 19, "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
+ "secretKey": { "index": 20, "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
},
"headers": {
"CamelAwsLambdaOperation": { "index": 0, "kind": "header", "displayName": "", "group": "all", "label": "all", "required": true, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation we want to perform. Override operation passed as query parameter", "constantName": "org.apache.camel.component.aws2.lambda.Lambda2Constants#OPERATION" },
diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
index e043ce35d9a..7e0a60d3441 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Component.java
@@ -22,13 +22,14 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
-import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.support.HealthCheckComponent;
/**
* For working with Amazon Lambda SDK v2.
*/
@Component("aws2-lambda")
-public class Lambda2Component extends DefaultComponent {
+public class Lambda2Component extends HealthCheckComponent {
+
@Metadata
private Lambda2Configuration configuration = new Lambda2Configuration();
diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
index 594f09907c8..035c46f18d2 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java
@@ -22,8 +22,6 @@ import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.component.aws2.lambda.client.Lambda2ClientFactory;
-import org.apache.camel.health.HealthCheckHelper;
-import org.apache.camel.impl.health.ComponentsHealthCheckRepository;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
@@ -42,9 +40,6 @@ public class Lambda2Endpoint extends DefaultEndpoint {
private LambdaClient awsLambdaClient;
- private ComponentsHealthCheckRepository healthCheckRepository;
- private Lambda2ClientHealthCheck clientHealthCheck;
-
@UriPath
@Metadata(required = true)
private String function;
@@ -66,6 +61,11 @@ public class Lambda2Endpoint extends DefaultEndpoint {
return new Lambda2Producer(this);
}
+ @Override
+ public Lambda2Component getComponent() {
+ return (Lambda2Component) super.getComponent();
+ }
+
public String getFunction() {
return function;
}
@@ -83,24 +83,10 @@ public class Lambda2Endpoint extends DefaultEndpoint {
awsLambdaClient = configuration.getAwsLambdaClient() != null
? configuration.getAwsLambdaClient()
: Lambda2ClientFactory.getLambdaClient(configuration).getLambdaClient();
-
- healthCheckRepository = HealthCheckHelper.getHealthCheckRepository(getCamelContext(),
- ComponentsHealthCheckRepository.REPOSITORY_ID, ComponentsHealthCheckRepository.class);
-
- if (healthCheckRepository != null) {
- // Do not register the health check until we resolve CAMEL-18992
- // clientHealthCheck = new Lambda2ClientHealthCheck(this, getId());
- // healthCheckRepository.addHealthCheck(clientHealthCheck);
- }
}
@Override
public void doStop() throws Exception {
- if (healthCheckRepository != null && clientHealthCheck != null) {
- healthCheckRepository.removeHealthCheck(clientHealthCheck);
- clientHealthCheck = null;
- }
-
if (ObjectHelper.isEmpty(configuration.getAwsLambdaClient())) {
if (awsLambdaClient != null) {
awsLambdaClient.close();
diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index f6b3e22a710..0153e72af16 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -27,6 +27,9 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.Message;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.health.HealthCheckHelper;
+import org.apache.camel.health.WritableHealthCheckRepository;
import org.apache.camel.support.DefaultProducer;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -85,6 +88,9 @@ public class Lambda2Producer extends DefaultProducer {
private static final Logger LOG = LoggerFactory.getLogger(Lambda2Producer.class);
+ private HealthCheck producerHealthCheck;
+ private WritableHealthCheckRepository healthCheckRepository;
+
public Lambda2Producer(final Endpoint endpoint) {
super(endpoint);
}
@@ -742,4 +748,29 @@ public class Lambda2Producer extends DefaultProducer {
return exchange.getMessage();
}
+ @Override
+ protected void doStart() throws Exception {
+ // health-check is optional so discover and resolve
+ healthCheckRepository = HealthCheckHelper.getHealthCheckRepository(
+ getEndpoint().getCamelContext(),
+ "components",
+ WritableHealthCheckRepository.class);
+
+ if (healthCheckRepository != null) {
+ String id = getEndpoint().getId();
+ producerHealthCheck = new Lambda2ProducerHealthCheck(getEndpoint(), id);
+ producerHealthCheck.setEnabled(getEndpoint().getComponent().isHealthCheckEnabled()
+ && getEndpoint().getComponent().isHealthCheckProducerEnabled());
+ healthCheckRepository.addHealthCheck(producerHealthCheck);
+ }
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ if (healthCheckRepository != null && producerHealthCheck != null) {
+ healthCheckRepository.removeHealthCheck(producerHealthCheck);
+ producerHealthCheck = null;
+ }
+ }
+
}
diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheck.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheck.java
similarity index 92%
rename from components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheck.java
rename to components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheck.java
index 902f856042a..4b067a4725e 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheck.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheck.java
@@ -27,12 +27,12 @@ import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.ListFunctionsRequest;
-public class Lambda2ClientHealthCheck extends AbstractHealthCheck {
+public class Lambda2ProducerHealthCheck extends AbstractHealthCheck {
private final Lambda2Endpoint lambda2Endpoint;
- public Lambda2ClientHealthCheck(Lambda2Endpoint lambda2Endpoint, String clientId) {
- super("camel", "aws2-lambda-client-" + clientId);
+ public Lambda2ProducerHealthCheck(Lambda2Endpoint lambda2Endpoint, String clientId) {
+ super("camel", "aws2-lambda-producer-" + clientId);
this.lambda2Endpoint = lambda2Endpoint;
}
diff --git a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckProfileCredsTest.java b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckProfileCredsTest.java
similarity index 87%
rename from components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckProfileCredsTest.java
rename to components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckProfileCredsTest.java
index a518ff3570c..71d0469958e 100644
--- a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckProfileCredsTest.java
+++ b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckProfileCredsTest.java
@@ -28,16 +28,11 @@ import org.apache.camel.health.HealthCheckRegistry;
import org.apache.camel.impl.health.DefaultHealthCheckRegistry;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
-public class Lambda2ClientHealthCheckProfileCredsTest extends CamelTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(Lambda2ClientHealthCheckProfileCredsTest.class);
+public class Lambda2ProducerHealthCheckProfileCredsTest extends CamelTestSupport {
CamelContext context;
@@ -73,9 +68,7 @@ public class Lambda2ClientHealthCheckProfileCredsTest extends CamelTestSupport {
}
@Test
- @Disabled("Do not register the Producer Health Check until we solve CAMEL-18992")
public void testConnectivity() {
-
Collection<HealthCheck.Result> res = HealthCheckHelper.invokeLiveness(context);
boolean up = res.stream().allMatch(r -> r.getState().equals(HealthCheck.State.UP));
Assertions.assertTrue(up, "liveness check");
@@ -85,9 +78,7 @@ public class Lambda2ClientHealthCheckProfileCredsTest extends CamelTestSupport {
Collection<HealthCheck.Result> res2 = HealthCheckHelper.invokeReadiness(context);
boolean down = res2.stream().allMatch(r -> r.getState().equals(HealthCheck.State.DOWN));
boolean containsAws2LambdaHealthCheck = res2.stream()
- .filter(result -> result.getCheck().getId().startsWith("aws2-lambda-client"))
- .findAny()
- .isPresent();
+ .anyMatch(result -> result.getCheck().getId().startsWith("aws2-lambda-producer"));
boolean hasRegionMessage = res2.stream()
.anyMatch(r -> r.getMessage().stream().anyMatch(msg -> msg.contains("region")));
Assertions.assertTrue(down, "liveness check");
diff --git a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckStaticCredsTest.java b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckStaticCredsTest.java
similarity index 87%
rename from components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckStaticCredsTest.java
rename to components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckStaticCredsTest.java
index 594a35d0ac6..643060fc7b0 100644
--- a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ClientHealthCheckStaticCredsTest.java
+++ b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/Lambda2ProducerHealthCheckStaticCredsTest.java
@@ -28,16 +28,11 @@ import org.apache.camel.health.HealthCheckRegistry;
import org.apache.camel.impl.health.DefaultHealthCheckRegistry;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
-public class Lambda2ClientHealthCheckStaticCredsTest extends CamelTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(Lambda2ClientHealthCheckStaticCredsTest.class);
+public class Lambda2ProducerHealthCheckStaticCredsTest extends CamelTestSupport {
CamelContext context;
@@ -73,9 +68,7 @@ public class Lambda2ClientHealthCheckStaticCredsTest extends CamelTestSupport {
}
@Test
- @Disabled("Do not register the Producer Health Check until we solve CAMEL-18992")
public void testConnectivity() {
-
Collection<HealthCheck.Result> res = HealthCheckHelper.invokeLiveness(context);
boolean up = res.stream().allMatch(r -> r.getState().equals(HealthCheck.State.UP));
Assertions.assertTrue(up, "liveness check");
@@ -85,9 +78,7 @@ public class Lambda2ClientHealthCheckStaticCredsTest extends CamelTestSupport {
Collection<HealthCheck.Result> res2 = HealthCheckHelper.invokeReadiness(context);
boolean down = res2.stream().allMatch(r -> r.getState().equals(HealthCheck.State.DOWN));
boolean containsAws2LambdaHealthCheck = res2.stream()
- .filter(result -> result.getCheck().getId().startsWith("aws2-lambda-client"))
- .findAny()
- .isPresent();
+ .anyMatch(result -> result.getCheck().getId().startsWith("aws2-lambda-producer"));
boolean hasRegionMessage = res2.stream()
.anyMatch(r -> r.getMessage().stream().anyMatch(msg -> msg.contains("region")));
Assertions.assertTrue(down, "liveness check");