gnodet-bot commented on code in PR #24844:
URL: https://github.com/apache/camel/pull/24844#discussion_r4069303607


##########
components/camel-apicurio-registry/src/main/java/org/apache/camel/component/apicurioregistry/ApicurioRegistryProducer.java:
##########
@@ -0,0 +1,241 @@
+/*
+ * 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.apicurioregistry;
+
+import java.io.InputStream;
+
+import io.apicurio.registry.rest.client.RegistryClient;
+import io.apicurio.registry.rest.client.models.ArtifactMetaData;
+import io.apicurio.registry.rest.client.models.CreateArtifact;
+import io.apicurio.registry.rest.client.models.CreateArtifactResponse;
+import io.apicurio.registry.rest.client.models.CreateGroup;
+import io.apicurio.registry.rest.client.models.CreateVersion;
+import io.apicurio.registry.rest.client.models.GroupMetaData;
+import io.apicurio.registry.rest.client.models.IfArtifactExists;
+import io.apicurio.registry.rest.client.models.RuleViolationProblemDetails;
+import io.apicurio.registry.rest.client.models.VersionContent;
+import io.apicurio.registry.rest.client.models.VersionMetaData;
+import io.apicurio.registry.rest.client.models.VersionSearchResults;
+import org.apache.camel.Message;
+import org.apache.camel.spi.InvokeOnHeader;
+import org.apache.camel.support.HeaderSelectorProducer;
+
+public class ApicurioRegistryProducer extends HeaderSelectorProducer {
+
+    private final ApicurioRegistryEndpoint endpoint;
+    private final ApicurioRegistryConfiguration configuration;
+
+    public ApicurioRegistryProducer(ApicurioRegistryEndpoint endpoint,
+                                    ApicurioRegistryConfiguration 
configuration) {
+        super(endpoint, ApicurioRegistryConstants.HEADER_OPERATION, 
configuration::getOperation);
+        this.endpoint = endpoint;
+        this.configuration = configuration;
+    }
+
+    private RegistryClient getClient() {
+        return endpoint.getRegistryClient();
+    }
+
+    private String resolveGroupId(Message message) {
+        String gid = 
message.getHeader(ApicurioRegistryConstants.HEADER_GROUP_ID, String.class);
+        return gid != null ? gid : endpoint.getGroupId();
+    }
+
+    private String resolveArtifactId(Message message) {
+        String aid = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_ID, String.class);
+        return aid != null ? aid : endpoint.getArtifactId();
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_CREATE_ARTIFACT)
+    public void createArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String artifactType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_ARTIFACT_TYPE, 
configuration.getArtifactType(), String.class);
+        String name = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_NAME, String.class);
+        String description = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_DESCRIPTION, 
String.class);
+        String content = message.getBody(String.class);
+        String contentType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_CONTENT_TYPE, 
"application/json", String.class);
+        String ifExistsVal = message.getHeader(
+                ApicurioRegistryConstants.HEADER_IF_EXISTS, 
configuration.getIfExists(), String.class);
+
+        CreateArtifact createArtifact = new CreateArtifact();
+        createArtifact.setArtifactId(artifactId);
+        createArtifact.setArtifactType(artifactType);
+        createArtifact.setName(name);
+        createArtifact.setDescription(description);
+
+        if (content != null) {
+            CreateVersion firstVersion = new CreateVersion();
+            VersionContent vc = new VersionContent();
+            vc.setContent(content);
+            vc.setContentType(contentType);
+            firstVersion.setContent(vc);
+            createArtifact.setFirstVersion(firstVersion);
+        }
+
+        CreateArtifactResponse result = 
getClient().groups().byGroupId(groupId).artifacts()
+                .post(createArtifact, config -> {
+                    if (ifExistsVal != null) {
+                        config.queryParameters.ifExists = 
IfArtifactExists.forValue(ifExistsVal);
+                    }
+                });
+        message.setBody(result);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_UPDATE_ARTIFACT)
+    public void updateArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String content = message.getBody(String.class);
+        String version = 
message.getHeader(ApicurioRegistryConstants.HEADER_VERSION, String.class);
+        String contentType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_CONTENT_TYPE, 
"application/json", String.class);
+
+        CreateVersion createVersion = new CreateVersion();
+        createVersion.setVersion(version);
+        VersionContent vc = new VersionContent();
+        vc.setContent(content);
+        vc.setContentType(contentType);
+        createVersion.setContent(vc);
+
+        VersionMetaData result = 
getClient().groups().byGroupId(groupId).artifacts()
+                .byArtifactId(artifactId).versions().post(createVersion);
+        message.setBody(result);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_DELETE_ARTIFACT)
+    public void deleteArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        
getClient().groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).delete();
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_GET_ARTIFACT_CONTENT)
+    public void getArtifactContent(Message message) throws Exception {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String version = message.getHeader(
+                ApicurioRegistryConstants.HEADER_VERSION, "branch=latest", 
String.class);
+
+        try (InputStream content = 
getClient().groups().byGroupId(groupId).artifacts()
+                
.byArtifactId(artifactId).versions().byVersionExpression(version).content().get())
 {
+            message.setBody(content.readAllBytes());
+        }
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_GET_ARTIFACT_METADATA)
+    public void getArtifactMetadata(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+
+        ArtifactMetaData metadata = 
getClient().groups().byGroupId(groupId).artifacts()
+                .byArtifactId(artifactId).get();
+        message.setBody(metadata);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_SEARCH_ARTIFACTS)
+    public void searchArtifacts(Message message) {
+        var results = getClient().search().artifacts().get(config -> {
+            String name = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_NAME, String.class);
+            String groupId = resolveGroupId(message);
+            String description = message.getHeader(
+                    ApicurioRegistryConstants.HEADER_ARTIFACT_DESCRIPTION, 
String.class);
+            if (name != null) {
+                config.queryParameters.name = name;
+            }
+            if (groupId != null) {
+                config.queryParameters.groupId = groupId;
+            }
+            if (description != null) {
+                config.queryParameters.description = description;
+            }
+        });
+        message.setBody(results);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_LIST_VERSIONS)
+    public void listVersions(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+
+        VersionSearchResults results = 
getClient().groups().byGroupId(groupId).artifacts()
+                .byArtifactId(artifactId).versions().get();
+        message.setBody(results);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_CREATE_GROUP)
+    public void createGroup(Message message) {
+        String groupId = resolveGroupId(message);
+        String description = message.getHeader(
+                ApicurioRegistryConstants.HEADER_ARTIFACT_DESCRIPTION, 
String.class);
+
+        CreateGroup createGroup = new CreateGroup();
+        createGroup.setGroupId(groupId);
+        createGroup.setDescription(description);
+
+        GroupMetaData result = getClient().groups().post(createGroup);
+        message.setBody(result);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_TEST_COMPATIBILITY)
+    public void testCompatibility(Message message) throws Exception {
+        boolean compatible = doDryRun(message);
+        message.setBody(compatible);

Review Comment:
   **`HEADER_VALIDATION_RESULT` not set by `testCompatibility`.**
   
   `validate` sets `HEADER_VALIDATION_RESULT` (boolean); `testCompatibility` 
only sets the body. Both call `doDryRun()` and return the same boolean. In a 
route that conditionally invokes either operation, callers must switch between 
`getHeader()` and `getBody()` depending on which op was used — a needless 
asymmetry that will trip users.
   
   ```suggestion
           boolean compatible = doDryRun(message);
           
message.setHeader(ApicurioRegistryConstants.HEADER_VALIDATION_RESULT, 
compatible);
           message.setBody(compatible);
   ```
   
   Add a corresponding assertion in `testTestCompatibilitySuccess` and 
`testTestCompatibilityFailure`:
   ```
   
assertThat(result.getIn().getHeader(ApicurioRegistryConstants.HEADER_VALIDATION_RESULT,
 Boolean.class)).isTrue(); // or isFalse()
   ```



##########
components/camel-apicurio-registry/src/main/java/org/apache/camel/component/apicurioregistry/ApicurioRegistryProducer.java:
##########
@@ -0,0 +1,241 @@
+/*
+ * 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.apicurioregistry;
+
+import java.io.InputStream;
+
+import io.apicurio.registry.rest.client.RegistryClient;
+import io.apicurio.registry.rest.client.models.ArtifactMetaData;
+import io.apicurio.registry.rest.client.models.CreateArtifact;
+import io.apicurio.registry.rest.client.models.CreateArtifactResponse;
+import io.apicurio.registry.rest.client.models.CreateGroup;
+import io.apicurio.registry.rest.client.models.CreateVersion;
+import io.apicurio.registry.rest.client.models.GroupMetaData;
+import io.apicurio.registry.rest.client.models.IfArtifactExists;
+import io.apicurio.registry.rest.client.models.RuleViolationProblemDetails;
+import io.apicurio.registry.rest.client.models.VersionContent;
+import io.apicurio.registry.rest.client.models.VersionMetaData;
+import io.apicurio.registry.rest.client.models.VersionSearchResults;
+import org.apache.camel.Message;
+import org.apache.camel.spi.InvokeOnHeader;
+import org.apache.camel.support.HeaderSelectorProducer;
+
+public class ApicurioRegistryProducer extends HeaderSelectorProducer {
+
+    private final ApicurioRegistryEndpoint endpoint;
+    private final ApicurioRegistryConfiguration configuration;
+
+    public ApicurioRegistryProducer(ApicurioRegistryEndpoint endpoint,
+                                    ApicurioRegistryConfiguration 
configuration) {
+        super(endpoint, ApicurioRegistryConstants.HEADER_OPERATION, 
configuration::getOperation);
+        this.endpoint = endpoint;
+        this.configuration = configuration;
+    }
+
+    private RegistryClient getClient() {
+        return endpoint.getRegistryClient();
+    }
+
+    private String resolveGroupId(Message message) {
+        String gid = 
message.getHeader(ApicurioRegistryConstants.HEADER_GROUP_ID, String.class);
+        return gid != null ? gid : endpoint.getGroupId();
+    }
+
+    private String resolveArtifactId(Message message) {
+        String aid = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_ID, String.class);
+        return aid != null ? aid : endpoint.getArtifactId();
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_CREATE_ARTIFACT)
+    public void createArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String artifactType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_ARTIFACT_TYPE, 
configuration.getArtifactType(), String.class);
+        String name = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_NAME, String.class);
+        String description = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_DESCRIPTION, 
String.class);
+        String content = message.getBody(String.class);
+        String contentType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_CONTENT_TYPE, 
"application/json", String.class);
+        String ifExistsVal = message.getHeader(
+                ApicurioRegistryConstants.HEADER_IF_EXISTS, 
configuration.getIfExists(), String.class);
+
+        CreateArtifact createArtifact = new CreateArtifact();
+        createArtifact.setArtifactId(artifactId);
+        createArtifact.setArtifactType(artifactType);
+        createArtifact.setName(name);
+        createArtifact.setDescription(description);
+
+        if (content != null) {
+            CreateVersion firstVersion = new CreateVersion();
+            VersionContent vc = new VersionContent();
+            vc.setContent(content);
+            vc.setContentType(contentType);
+            firstVersion.setContent(vc);
+            createArtifact.setFirstVersion(firstVersion);
+        }
+
+        CreateArtifactResponse result = 
getClient().groups().byGroupId(groupId).artifacts()
+                .post(createArtifact, config -> {
+                    if (ifExistsVal != null) {
+                        config.queryParameters.ifExists = 
IfArtifactExists.forValue(ifExistsVal);
+                    }
+                });
+        message.setBody(result);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_UPDATE_ARTIFACT)
+    public void updateArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String content = message.getBody(String.class);
+        String version = 
message.getHeader(ApicurioRegistryConstants.HEADER_VERSION, String.class);
+        String contentType = message.getHeader(
+                ApicurioRegistryConstants.HEADER_CONTENT_TYPE, 
"application/json", String.class);
+
+        CreateVersion createVersion = new CreateVersion();
+        createVersion.setVersion(version);
+        VersionContent vc = new VersionContent();
+        vc.setContent(content);
+        vc.setContentType(contentType);
+        createVersion.setContent(vc);
+
+        VersionMetaData result = 
getClient().groups().byGroupId(groupId).artifacts()
+                .byArtifactId(artifactId).versions().post(createVersion);
+        message.setBody(result);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_DELETE_ARTIFACT)
+    public void deleteArtifact(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        
getClient().groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).delete();
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_GET_ARTIFACT_CONTENT)
+    public void getArtifactContent(Message message) throws Exception {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+        String version = message.getHeader(
+                ApicurioRegistryConstants.HEADER_VERSION, "branch=latest", 
String.class);
+
+        try (InputStream content = 
getClient().groups().byGroupId(groupId).artifacts()
+                
.byArtifactId(artifactId).versions().byVersionExpression(version).content().get())
 {
+            message.setBody(content.readAllBytes());
+        }
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_GET_ARTIFACT_METADATA)
+    public void getArtifactMetadata(Message message) {
+        String groupId = resolveGroupId(message);
+        String artifactId = resolveArtifactId(message);
+
+        ArtifactMetaData metadata = 
getClient().groups().byGroupId(groupId).artifacts()
+                .byArtifactId(artifactId).get();
+        message.setBody(metadata);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_SEARCH_ARTIFACTS)
+    public void searchArtifacts(Message message) {
+        var results = getClient().search().artifacts().get(config -> {
+            String name = 
message.getHeader(ApicurioRegistryConstants.HEADER_ARTIFACT_NAME, String.class);
+            String groupId = resolveGroupId(message);
+            String description = message.getHeader(
+                    ApicurioRegistryConstants.HEADER_ARTIFACT_DESCRIPTION, 
String.class);
+            if (name != null) {
+                config.queryParameters.name = name;
+            }
+            if (groupId != null) {
+                config.queryParameters.groupId = groupId;
+            }
+            if (description != null) {
+                config.queryParameters.description = description;
+            }
+        });
+        message.setBody(results);
+    }
+
+    @InvokeOnHeader(ApicurioRegistryConstants.OPERATION_LIST_VERSIONS)

Review Comment:
   **[Re-raised] `testCompatibility` does not set `HEADER_VALIDATION_RESULT`.**
   
   `validate()` sets `HEADER_VALIDATION_RESULT` (boolean) on the exchange so 
callers can branch on a header without parsing the body. `testCompatibility()` 
only calls `message.setBody(compatible)` — the header is absent. Both 
operations share `doDryRun()` and return the same boolean, so the asymmetry is 
almost certainly an oversight. In a route that dispatches both operations via 
`HEADER_OPERATION`, callers must switch between `getBody()` and `getHeader()` 
depending on which op ran — undocumented and fragile.
   
   ```suggestion
           
message.setHeader(ApicurioRegistryConstants.HEADER_VALIDATION_RESULT, 
compatible);
           message.setBody(compatible);
   ```
   
   Also update `HEADER_VALIDATION_RESULT`'s `@Metadata` description to: 
`"Whether validation passed. Set by validate and testCompatibility."`



##########
components/camel-apicurio-registry/src/main/java/org/apache/camel/component/apicurioregistry/ApicurioRegistryConsumer.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.apicurioregistry;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import io.apicurio.registry.rest.client.RegistryClient;
+import io.apicurio.registry.rest.client.models.SearchedVersion;
+import io.apicurio.registry.rest.client.models.VersionSearchResults;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.support.ScheduledPollConsumer;
+
+public class ApicurioRegistryConsumer extends ScheduledPollConsumer {
+
+    private final ApicurioRegistryEndpoint endpoint;
+    private final ApicurioRegistryConfiguration configuration;
+    private volatile Long lastSeenGlobalId;
+
+    public ApicurioRegistryConsumer(ApicurioRegistryEndpoint endpoint, 
Processor processor,
+                                    ApicurioRegistryConfiguration 
configuration) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+        this.configuration = configuration;
+    }
+
+    @Override
+    protected int poll() throws Exception {
+        String groupId = endpoint.getGroupId();
+        String artifactId = endpoint.getArtifactId();
+

Review Comment:
   **[Re-raised] Unbounded `versions().get()` — silent data loss on artifacts 
with more than 20 versions.**
   
   The Apicurio Registry v3 API paginates version lists (default page cap: 20). 
Calling `.versions().get()` with no `limit`/`offset` means the consumer 
silently sees only the first page. For an artifact that has accumulated more 
than 20 versions — common in long-running schema evolution — the consumer 
misses versions outside the first page on startup, and once `lastSeenGlobalId` 
advances past that window those versions are lost permanently.
   
   Fix: pass a large `limit` (or implement a pagination loop). At minimum, 
document the default-page constraint in the AsciiDoc and warn when the returned 
count equals the page size.
   
   ```suggestion
           VersionSearchResults results = client.groups().byGroupId(groupId)
                   .artifacts().byArtifactId(artifactId).versions().get(config 
-> {
                       config.queryParameters.limit = 200;
                       config.queryParameters.offset = 0;
                   });
   ```
   
   Note: even `limit=200` truncates very large artifacts. A pagination loop is 
the correct fix, but a documented hard cap is acceptable for Preview.



##########
components/camel-apicurio-registry/src/main/java/org/apache/camel/component/apicurioregistry/ApicurioRegistryEndpoint.java:
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.apicurioregistry;
+
+import java.util.concurrent.TimeUnit;
+
+import io.apicurio.registry.client.RegistryClientFactory;
+import io.apicurio.registry.client.common.RegistryClientOptions;
+import io.apicurio.registry.rest.client.RegistryClient;
+import io.vertx.core.Vertx;
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.EndpointServiceLocation;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.ScheduledPollEndpoint;
+
+/**
+ * Manage artifacts, versions, and groups in Apicurio Registry v3.
+ */
+@UriEndpoint(firstVersion = "4.23.0", scheme = "apicurio-registry", title = 
"Apicurio Registry",
+             syntax = "apicurio-registry:groupId/artifactId",
+             category = { Category.CLOUD, Category.API }, headersClass = 
ApicurioRegistryConstants.class)
+public class ApicurioRegistryEndpoint extends ScheduledPollEndpoint implements 
EndpointServiceLocation {
+
+    @UriPath(description = "The artifact group ID")
+    private String groupId;
+
+    @UriPath(description = "The artifact ID")
+    private String artifactId;
+
+    @UriParam
+    private ApicurioRegistryConfiguration configuration;
+
+    @UriParam(label = "advanced", description = "To use a pre-configured 
RegistryClient instance")
+    private RegistryClient registryClient;
+
+    private Vertx vertx;
+
+    ApicurioRegistryEndpoint(String uri, ApicurioRegistryComponent component,
+                             ApicurioRegistryConfiguration configuration,
+                             String groupId, String artifactId) {
+        super(uri, component);
+        this.configuration = configuration;
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        return new ApicurioRegistryProducer(this, configuration);
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        ApicurioRegistryConsumer consumer = new ApicurioRegistryConsumer(this, 
processor, configuration);
+        configureConsumer(consumer);
+        return consumer;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (registryClient == null) {
+            vertx = Vertx.vertx();
+            try {
+                registryClient = createRegistryClient();
+            } catch (Exception e) {
+                closeVertx();
+                throw e;
+            }
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (vertx != null) {
+            registryClient = null;
+            closeVertx();
+        }
+    }
+
+    private void closeVertx() throws Exception {
+        try {
+            vertx.close().toCompletionStage().toCompletableFuture().get(30, 
TimeUnit.SECONDS);
+        } finally {
+            vertx = null;
+        }
+    }
+
+    private RegistryClient createRegistryClient() {
+        RegistryClientOptions options = 
RegistryClientOptions.create(configuration.getRegistryUrl(), vertx);
+        String authType = configuration.getAuthType();
+        if ("basic".equalsIgnoreCase(authType)) {
+            options.basicAuth(configuration.getUsername(), 
configuration.getPassword());
+        } else if ("oidc".equalsIgnoreCase(authType)) {
+            options.oauth2(configuration.getTokenEndpoint(), 
configuration.getClientId(),
+                    configuration.getClientSecret(), configuration.getScope());
+        }
+        return RegistryClientFactory.create(options);
+    }
+
+    public RegistryClient getRegistryClient() {
+        return registryClient;
+    }
+
+    public void setRegistryClient(RegistryClient registryClient) {
+        this.registryClient = registryClient;
+    }
+
+    public String getGroupId() {

Review Comment:
   **[Re-raised] `getServiceProtocol()` returns `"http"` — wrong identifier, 
breaks HTTPS and observability.**
   
   `EndpointServiceLocation.getServiceProtocol()` is a **logical service 
name**, not a transport scheme. Across the Camel codebase every HTTP-backed 
component returns its own scheme name here (e.g. `"github"`, `"slack"`, 
`"elasticsearch"`, `"aws-s3"`), not the transport. Returning `"http"` makes 
HTTPS registry deployments appear as plain HTTP in Camel's service 
health/observability UI and mis-categorises the endpoint in service-discovery 
tooling.
   
   ```suggestion
           return "apicurio-registry";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to