You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "svkcemk (via GitHub)" <gi...@apache.org> on 2026/03/04 08:59:16 UTC
[PR] Add tests and native support for milvus extension [camel-quarkus]
svkcemk opened a new pull request, #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372
<!-- Uncomment and fill this section if your PR is not trivial
[ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
[ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
[ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
[ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
[ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
[ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
-->
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#issuecomment-3997393832
@svkcemk Looks it fails under **integration-tests-alternative-platform (windows-latest)**
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton merged PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "svkcemk (via GitHub)" <gi...@apache.org>.
svkcemk commented on code in PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#discussion_r2887662124
##########
extensions/milvus/deployment/src/main/java/org/apache/camel/quarkus/component/milvus/deployment/MilvusProcessor.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * 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.quarkus.component.milvus.deployment;
+
+import java.util.List;
+import java.util.Set;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.commons.ClassRemapper;
+import org.objectweb.asm.commons.Remapper;
+
+class MilvusProcessor {
+
+ /**
+ * Intercepts all Milvus SDK classes during the Quarkus build process to perform
+ * bytecode transformation. This ensures the SDK points to the correct
+ * gRPC/Netty implementations, avoiding 'Class Not Found'
+ */
+
+ @BuildStep
+ void relocateAllShadedCalls(
+ CombinedIndexBuildItem index,
+ BuildProducer<BytecodeTransformerBuildItem> transformers) {
+
+ index.getIndex().getKnownClasses().stream()
+ .filter(ci -> {
+ String name = ci.name().toString();
+ return name.startsWith("io.milvus");
+ })
+ .forEach(ci -> {
+ transformers.produce(new BytecodeTransformerBuildItem(
+ ci.name().toString(),
+ (name, cv) -> new ShadedRelocationVisitor(cv)));
+ });
+ }
+
+ @BuildStep
+ List<IndexDependencyBuildItem> indexDependencies() {
+ return List.of(
+ new IndexDependencyBuildItem("io.milvus", "milvus-sdk-java"),
+ new IndexDependencyBuildItem("com.google.protobuf", "protobuf-java"));
+ }
+
+ /**
+ * Registers gRPC Service Providers (SPI) for the Native executable.
+ * In Native mode, GraalVM does not automatically discover services in
+ * META-INF/services.
+ */
+
+ @BuildStep
+ void registerGrpcServiceProvider(BuildProducer<ServiceProviderBuildItem> services) {
+
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.ManagedChannelProvider",
+ "io.grpc.netty.NettyChannelProvider"));
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.NameResolverProvider",
+ "io.grpc.internal.DnsNameResolverProvider"));
+
+ services.produce(new ServiceProviderBuildItem("io.grpc.LoadBalancerProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.util.OutlierDetectionLoadBalancerProvider",
+ "io.grpc.util.RandomSubsettingLoadBalancerProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider"));
+ }
+
+ @BuildStep
+ void registerReflection(CombinedIndexBuildItem index, BuildProducer<ReflectiveClassBuildItem> reflection) {
+
+ // Infrastructure & Clients: gRPC, Netty, and Milvus
+ reflection.produce(ReflectiveClassBuildItem.builder(
+ "io.grpc.internal.DnsNameResolverProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.netty.NettyChannelProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
+ "io.grpc.netty.GrpcSslContexts",
+ "io.grpc.netty.UdsNettyChannelProvider",
+ "io.grpc.netty.UdsNameResolverProvider",
Review Comment:
I just moved to quarkus-grpc-common and its removed lots of unnecessary stuff!
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#discussion_r2883908789
##########
extensions/milvus/deployment/src/main/java/org/apache/camel/quarkus/component/milvus/deployment/MilvusProcessor.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * 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.quarkus.component.milvus.deployment;
+
+import java.util.List;
+import java.util.Set;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.commons.ClassRemapper;
+import org.objectweb.asm.commons.Remapper;
+
+class MilvusProcessor {
+
+ /**
+ * Intercepts all Milvus SDK classes during the Quarkus build process to perform
+ * bytecode transformation. This ensures the SDK points to the correct
+ * gRPC/Netty implementations, avoiding 'Class Not Found'
+ */
+
+ @BuildStep
+ void relocateAllShadedCalls(
+ CombinedIndexBuildItem index,
+ BuildProducer<BytecodeTransformerBuildItem> transformers) {
+
+ index.getIndex().getKnownClasses().stream()
+ .filter(ci -> {
+ String name = ci.name().toString();
+ return name.startsWith("io.milvus");
+ })
+ .forEach(ci -> {
+ transformers.produce(new BytecodeTransformerBuildItem(
+ ci.name().toString(),
+ (name, cv) -> new ShadedRelocationVisitor(cv)));
+ });
+ }
+
+ @BuildStep
+ List<IndexDependencyBuildItem> indexDependencies() {
+ return List.of(
+ new IndexDependencyBuildItem("io.milvus", "milvus-sdk-java"),
+ new IndexDependencyBuildItem("com.google.protobuf", "protobuf-java"));
+ }
+
+ /**
+ * Registers gRPC Service Providers (SPI) for the Native executable.
+ * In Native mode, GraalVM does not automatically discover services in
+ * META-INF/services.
+ */
+
+ @BuildStep
+ void registerGrpcServiceProvider(BuildProducer<ServiceProviderBuildItem> services) {
+
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.ManagedChannelProvider",
+ "io.grpc.netty.NettyChannelProvider"));
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.NameResolverProvider",
+ "io.grpc.internal.DnsNameResolverProvider"));
+
+ services.produce(new ServiceProviderBuildItem("io.grpc.LoadBalancerProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.util.OutlierDetectionLoadBalancerProvider",
+ "io.grpc.util.RandomSubsettingLoadBalancerProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider"));
+ }
+
+ @BuildStep
+ void registerReflection(CombinedIndexBuildItem index, BuildProducer<ReflectiveClassBuildItem> reflection) {
+
+ // Infrastructure & Clients: gRPC, Netty, and Milvus
+ reflection.produce(ReflectiveClassBuildItem.builder(
+ "io.grpc.internal.DnsNameResolverProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.netty.NettyChannelProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
+ "io.grpc.netty.GrpcSslContexts",
+ "io.grpc.netty.UdsNettyChannelProvider",
+ "io.grpc.netty.UdsNameResolverProvider",
Review Comment:
Have you tried oto use io.quarkus:grpc* to avoid having to configure the processor for grpc classes?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#discussion_r2883955239
##########
extensions/milvus/deployment/src/main/java/org/apache/camel/quarkus/component/milvus/deployment/MilvusProcessor.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * 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.quarkus.component.milvus.deployment;
+
+import java.util.List;
+import java.util.Set;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.commons.ClassRemapper;
+import org.objectweb.asm.commons.Remapper;
+
+class MilvusProcessor {
+
+ /**
+ * Intercepts all Milvus SDK classes during the Quarkus build process to perform
+ * bytecode transformation. This ensures the SDK points to the correct
+ * gRPC/Netty implementations, avoiding 'Class Not Found'
+ */
+
+ @BuildStep
+ void relocateAllShadedCalls(
+ CombinedIndexBuildItem index,
+ BuildProducer<BytecodeTransformerBuildItem> transformers) {
+
+ index.getIndex().getKnownClasses().stream()
+ .filter(ci -> {
+ String name = ci.name().toString();
+ return name.startsWith("io.milvus");
+ })
+ .forEach(ci -> {
+ transformers.produce(new BytecodeTransformerBuildItem(
+ ci.name().toString(),
+ (name, cv) -> new ShadedRelocationVisitor(cv)));
+ });
+ }
+
+ @BuildStep
+ List<IndexDependencyBuildItem> indexDependencies() {
+ return List.of(
+ new IndexDependencyBuildItem("io.milvus", "milvus-sdk-java"),
+ new IndexDependencyBuildItem("com.google.protobuf", "protobuf-java"));
+ }
+
+ /**
+ * Registers gRPC Service Providers (SPI) for the Native executable.
+ * In Native mode, GraalVM does not automatically discover services in
+ * META-INF/services.
+ */
+
+ @BuildStep
+ void registerGrpcServiceProvider(BuildProducer<ServiceProviderBuildItem> services) {
+
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.ManagedChannelProvider",
+ "io.grpc.netty.NettyChannelProvider"));
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.NameResolverProvider",
+ "io.grpc.internal.DnsNameResolverProvider"));
+
+ services.produce(new ServiceProviderBuildItem("io.grpc.LoadBalancerProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.util.OutlierDetectionLoadBalancerProvider",
+ "io.grpc.util.RandomSubsettingLoadBalancerProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider"));
+ }
+
+ @BuildStep
+ void registerReflection(CombinedIndexBuildItem index, BuildProducer<ReflectiveClassBuildItem> reflection) {
+
+ // Infrastructure & Clients: gRPC, Netty, and Milvus
+ reflection.produce(ReflectiveClassBuildItem.builder(
+ "io.grpc.internal.DnsNameResolverProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.netty.NettyChannelProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
+ "io.grpc.netty.GrpcSslContexts",
+ "io.grpc.netty.UdsNettyChannelProvider",
+ "io.grpc.netty.UdsNameResolverProvider",
Review Comment:
It's usually enough to have `quarkus-grpc-common` to get the native mode support. The full `quarkus-grpc` pulls in a lot of extra unwanted stuff.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#issuecomment-3997749717
> @svkcemk Looks it fails under **integration-tests-alternative-platform (windows-latest)**
The integration test module will need a profile like this, since there's no Docker on the Windows runner:
https://github.com/apache/camel-quarkus/blob/74f8390f49c4b0ffb7a7fb2bfe1a502fc3603dd1/integration-tests/jsch/pom.xml#L113-L123
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "svkcemk (via GitHub)" <gi...@apache.org>.
svkcemk commented on code in PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#discussion_r2884354863
##########
extensions/milvus/deployment/src/main/java/org/apache/camel/quarkus/component/milvus/deployment/MilvusProcessor.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * 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.quarkus.component.milvus.deployment;
+
+import java.util.List;
+import java.util.Set;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.commons.ClassRemapper;
+import org.objectweb.asm.commons.Remapper;
+
+class MilvusProcessor {
+
+ /**
+ * Intercepts all Milvus SDK classes during the Quarkus build process to perform
+ * bytecode transformation. This ensures the SDK points to the correct
+ * gRPC/Netty implementations, avoiding 'Class Not Found'
+ */
+
+ @BuildStep
+ void relocateAllShadedCalls(
+ CombinedIndexBuildItem index,
+ BuildProducer<BytecodeTransformerBuildItem> transformers) {
+
+ index.getIndex().getKnownClasses().stream()
+ .filter(ci -> {
+ String name = ci.name().toString();
+ return name.startsWith("io.milvus");
+ })
+ .forEach(ci -> {
+ transformers.produce(new BytecodeTransformerBuildItem(
+ ci.name().toString(),
+ (name, cv) -> new ShadedRelocationVisitor(cv)));
+ });
+ }
+
+ @BuildStep
+ List<IndexDependencyBuildItem> indexDependencies() {
+ return List.of(
+ new IndexDependencyBuildItem("io.milvus", "milvus-sdk-java"),
+ new IndexDependencyBuildItem("com.google.protobuf", "protobuf-java"));
+ }
+
+ /**
+ * Registers gRPC Service Providers (SPI) for the Native executable.
+ * In Native mode, GraalVM does not automatically discover services in
+ * META-INF/services.
+ */
+
+ @BuildStep
+ void registerGrpcServiceProvider(BuildProducer<ServiceProviderBuildItem> services) {
+
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.ManagedChannelProvider",
+ "io.grpc.netty.NettyChannelProvider"));
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.NameResolverProvider",
+ "io.grpc.internal.DnsNameResolverProvider"));
+
+ services.produce(new ServiceProviderBuildItem("io.grpc.LoadBalancerProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.util.OutlierDetectionLoadBalancerProvider",
+ "io.grpc.util.RandomSubsettingLoadBalancerProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider"));
+ }
+
+ @BuildStep
+ void registerReflection(CombinedIndexBuildItem index, BuildProducer<ReflectiveClassBuildItem> reflection) {
+
+ // Infrastructure & Clients: gRPC, Netty, and Milvus
+ reflection.produce(ReflectiveClassBuildItem.builder(
+ "io.grpc.internal.DnsNameResolverProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.netty.NettyChannelProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
+ "io.grpc.netty.GrpcSslContexts",
+ "io.grpc.netty.UdsNettyChannelProvider",
+ "io.grpc.netty.UdsNameResolverProvider",
Review Comment:
Thanks I thought of using quarkus-grpc at some point, let me switch to it and update accordingly it will be much cleaner way to handle it.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "svkcemk (via GitHub)" <gi...@apache.org>.
svkcemk commented on code in PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#discussion_r2884354863
##########
extensions/milvus/deployment/src/main/java/org/apache/camel/quarkus/component/milvus/deployment/MilvusProcessor.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * 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.quarkus.component.milvus.deployment;
+
+import java.util.List;
+import java.util.Set;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.commons.ClassRemapper;
+import org.objectweb.asm.commons.Remapper;
+
+class MilvusProcessor {
+
+ /**
+ * Intercepts all Milvus SDK classes during the Quarkus build process to perform
+ * bytecode transformation. This ensures the SDK points to the correct
+ * gRPC/Netty implementations, avoiding 'Class Not Found'
+ */
+
+ @BuildStep
+ void relocateAllShadedCalls(
+ CombinedIndexBuildItem index,
+ BuildProducer<BytecodeTransformerBuildItem> transformers) {
+
+ index.getIndex().getKnownClasses().stream()
+ .filter(ci -> {
+ String name = ci.name().toString();
+ return name.startsWith("io.milvus");
+ })
+ .forEach(ci -> {
+ transformers.produce(new BytecodeTransformerBuildItem(
+ ci.name().toString(),
+ (name, cv) -> new ShadedRelocationVisitor(cv)));
+ });
+ }
+
+ @BuildStep
+ List<IndexDependencyBuildItem> indexDependencies() {
+ return List.of(
+ new IndexDependencyBuildItem("io.milvus", "milvus-sdk-java"),
+ new IndexDependencyBuildItem("com.google.protobuf", "protobuf-java"));
+ }
+
+ /**
+ * Registers gRPC Service Providers (SPI) for the Native executable.
+ * In Native mode, GraalVM does not automatically discover services in
+ * META-INF/services.
+ */
+
+ @BuildStep
+ void registerGrpcServiceProvider(BuildProducer<ServiceProviderBuildItem> services) {
+
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.ManagedChannelProvider",
+ "io.grpc.netty.NettyChannelProvider"));
+ services.produce(new ServiceProviderBuildItem(
+ "io.grpc.NameResolverProvider",
+ "io.grpc.internal.DnsNameResolverProvider"));
+
+ services.produce(new ServiceProviderBuildItem("io.grpc.LoadBalancerProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.util.OutlierDetectionLoadBalancerProvider",
+ "io.grpc.util.RandomSubsettingLoadBalancerProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider"));
+ }
+
+ @BuildStep
+ void registerReflection(CombinedIndexBuildItem index, BuildProducer<ReflectiveClassBuildItem> reflection) {
+
+ // Infrastructure & Clients: gRPC, Netty, and Milvus
+ reflection.produce(ReflectiveClassBuildItem.builder(
+ "io.grpc.internal.DnsNameResolverProvider",
+ "io.grpc.internal.PickFirstLoadBalancerProvider",
+ "io.grpc.netty.NettyChannelProvider",
+ "io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
+ "io.grpc.netty.GrpcSslContexts",
+ "io.grpc.netty.UdsNettyChannelProvider",
+ "io.grpc.netty.UdsNameResolverProvider",
Review Comment:
Thanks I thought of using quarkus-grpc at some point, let me switch to it and update accordingly it will be much cleaner way to handle it.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests and native support for milvus extension [camel-quarkus]
Posted by "svkcemk (via GitHub)" <gi...@apache.org>.
svkcemk commented on PR #8372:
URL: https://github.com/apache/camel-quarkus/pull/8372#issuecomment-4003480061
Looks like elasticsearch tests are failing
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org