This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-20798-AWS-complete in repository https://gitbox.apache.org/repos/asf/camel.git
commit 47f6fcb202224efd2875d9d85392bf3e3fbdfebf Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Jun 18 10:25:10 2024 +0200 CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - AWS MQ Signed-off-by: Andrea Cosentino <[email protected]> --- .../camel/component/aws2/mq/MQ2Endpoint.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/components/camel-aws/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Endpoint.java b/components/camel-aws/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Endpoint.java index a0afcd05f24..ae7640fe076 100644 --- a/components/camel-aws/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Endpoint.java +++ b/components/camel-aws/camel-aws2-mq/src/main/java/org/apache/camel/component/aws2/mq/MQ2Endpoint.java @@ -22,18 +22,21 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.mq.client.MQ2ClientFactory; +import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ScheduledPollEndpoint; import org.apache.camel.util.ObjectHelper; import software.amazon.awssdk.services.mq.MqClient; +import java.util.Map; + /** * Send messages to AWS MQ. */ @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-mq", title = "AWS MQ", syntax = "aws2-mq:label", producerOnly = true, category = { Category.CLOUD, Category.MESSAGING }, headersClass = MQ2Constants.class) -public class MQ2Endpoint extends ScheduledPollEndpoint { +public class MQ2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private MqClient mqClient; @@ -86,4 +89,21 @@ public class MQ2Endpoint extends ScheduledPollEndpoint { public MqClient getAmazonMqClient() { return mqClient; } + + @Override + public String getServiceUrl() { + if (!configuration.isOverrideEndpoint()) { + if (ObjectHelper.isNotEmpty(configuration.getRegion())) { + return configuration.getRegion(); + } + } else if (ObjectHelper.isNotEmpty(configuration.getUriEndpointOverride())) { + return configuration.getUriEndpointOverride(); + } + return null; + } + + @Override + public String getServiceProtocol() { + return "mq"; + } }
